Closed ivmaykov closed 1 year ago
I forced a failure by modifying the signature constant in config.h to test this. Output on failure looks like this:
[INFO] src/checks/self_checks.c:85 ===== SELF CHECKS SUMMARY =====
[INFO] src/checks/self_checks.c:90 pre_run_self_checks: succeeded
[INFO] src/checks/self_checks.c:90 verify_byte_order: succeeded
[INFO] src/checks/self_checks.c:90 verify_mix_entropy: succeeded
[INFO] src/checks/self_checks.c:90 verify_protect_pubkey: succeeded
[INFO] src/checks/self_checks.c:90 verify_bip32: succeeded
[ERROR] src/checks/self_checks.c:92 verify_sign_tx: failed with result -1
[INFO] src/checks/self_checks.c:90 verify_check_qrsignature_pub: succeeded
[INFO] src/checks/self_checks.c:90 verify_validate_fees: succeeded
[INFO] src/checks/self_checks.c:90 verify_no_rollback: succeeded
[INFO] src/checks/self_checks.c:90 verify_no_rollback_write_to_buf: succeeded
[INFO] src/checks/self_checks.c:90 verify_conv_btc_to_satoshi: succeeded
[INFO] src/checks/self_checks.c:90 verify_wycheproof: succeeded
[INFO] src/checks/self_checks.c:90 verify_rpc_oversized_message_rejected: succeeded
[INFO] src/checks/self_checks.c:90 post_run_self_checks: succeeded
[INFO] src/checks/self_checks.c:98 ===== END SELF CHECKS SUMMARY =====
[ERROR] src/main.c:67 run_self_checks failed
Print a summary of self checks in subzero core if any of them failed.
I wrote this change after messing with my at-home HSM and at some point I got a self check failure and couldn't tell what check(s) actually failed. This change helps with that.
Also refactors the registration code so pre_run_self_checks() and post_run_self_checks() are registered and executed the same way as everything else.