-
Notifications
You must be signed in to change notification settings - Fork 902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lightningd: test that hsm_secret is as expected, at startup. #5425
lightningd: test that hsm_secret is as expected, at startup. #5425
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 26542c1
lightningd/lightningd.c
Outdated
* We also check that our node_id is what we expect: otherwise a change | ||
* in hsm_secret will have strange consequences! */ | ||
if (!wallet_sanity_check(ld->wallet)) | ||
errx(1, "Wallet sanity check failed."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errx(1, "Wallet sanity check failed."); | |
errx(WALLET_MISMATCH, "Wallet sanity check failed."); |
What do you think to add a more accurate error here? this use case looks like a use case that can happens during some scripting stuff (raspiblitz stuff are usually happy with specific error on the cmd)
But maybe there are other reason to return a generic one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good improvement! I'll add another commit...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this is a cleanup which deserves its own (not 0.12) branch....
*and Suggested-By: @fiatjaf! |
26542c1
to
9ffe68f
Compare
Trivial rebase on master, added Changelog-Changed line. |
9ffe68f
to
b6544a5
Compare
Didn't know/remember that, but I've credited him too! |
If you get the wrong hsm_secret, your node_id will change, and peers won't know who you are, bitcoind will reject your transaction signatures, and other madness. Catch this as soon as it happens, by storing our node_id in the db. Suggested-by: @cdecker, @fiatjaf Signed-off-by: Rusty Russell <[email protected]> Changelog-Changed: Config: `lightningd` will refuse to start with the wrong node_id (i.e. hsm_secret changes).
Most unexpected ones are still 1, but there are a few recognizable error codes worth documenting. Rename the HSM ones to put ERRCODE_ at the front, since we have non-HSM ones too now. Signed-off-by: Rusty Russell <[email protected]>
b6544a5
to
57da410
Compare
Fixed hsm generation test, which barfed because we change secret... Ack 57da410 |
If you get the wrong hsm_secret, your node_id will change, and
peers won't know who you are, bitcoind will reject your transaction
signatures, and other madness.
Catch this as soon as it happens, by storing our node_id in the db.
Suggested-by: @cdecker