Skip to content

Commit f0336e8

Browse files
authored
Merge pull request #18004 from MinaProtocol/lyh/verbose-ledger-download-failure-message
Report file size on ledger hash mismatch
2 parents 3b078bf + a781424 commit f0336e8

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
@@ -67,6 +67,8 @@ let assert_filehash_equal ~file ~hash ~logger =
6767
let%bind computed_hash = sha3_hash file in
6868
if String.equal computed_hash hash then Deferred.unit
6969
else
70+
let%bind stats = Unix.stat file in
71+
let file_size = stats.size in
7072
let%map () = Unix.rename ~src:file ~dst:(file ^ ".incorrect-hash") in
7173
[%log error]
7274
"Verification failure: downloaded $path and expected SHA3-256 = \
@@ -75,6 +77,7 @@ let assert_filehash_equal ~file ~hash ~logger =
7577
[ ("path", `String file)
7678
; ("expected_hash", `String hash)
7779
; ("computed_hash", `String computed_hash)
80+
; ("file_size", `String (Int64.to_string file_size))
7881
] ;
7982
failwith "Tarball hash mismatch"
8083

0 commit comments

Comments
 (0)