Skip to content

Commit a781424

Browse files
committed
Report file size on ledger hash mismatch
1 parent f0aef61 commit a781424

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/lib/genesis_ledger_helper/genesis_ledger_helper.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ let assert_filehash_equal ~file ~hash ~logger =
6666
let%bind computed_hash = sha3_hash file in
6767
if String.equal computed_hash hash then Deferred.unit
6868
else
69+
let%bind stats = Unix.stat file in
70+
let file_size = stats.size in
6971
let%map () = Unix.rename ~src:file ~dst:(file ^ ".incorrect-hash") in
7072
[%log error]
7173
"Verification failure: downloaded $path and expected SHA3-256 = \
@@ -74,6 +76,7 @@ let assert_filehash_equal ~file ~hash ~logger =
7476
[ ("path", `String file)
7577
; ("expected_hash", `String hash)
7678
; ("computed_hash", `String computed_hash)
79+
; ("file_size", `String (Int64.to_string file_size))
7780
] ;
7881
failwith "Tarball hash mismatch"
7982

0 commit comments

Comments
 (0)