-
Notifications
You must be signed in to change notification settings - Fork 910
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
Update emergency.recover after every 'commitment_revocation' so that user can sweep funds by penalty transaction. #7772
base: master
Are you sure you want to change the base?
Conversation
bbea1f1
to
ca3b3de
Compare
6c70397
to
eeb239f
Compare
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.
Nice! Only one minor cleanup suggestion.
I'll rebase now...
wallet/wallet.c
Outdated
|
||
for (u32 pos = 0; pos < chain->chain.num_valid; pos++) { | ||
struct secret s; | ||
memcpy(&s, &chain->chain.known[pos].hash, sizeof(s)); |
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.
We have a new macro for, this: CROSS_TYPE_ASSIGNMENT(&s, &chain->chain.known[pos].hash). It checks the two types are same size...
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.
Fixed it. Thanks!!
eeb239f
to
98b6ae4
Compare
Rebased on master with simple API fixes. |
84bebbf
to
7f13d7b
Compare
7f13d7b
to
6020851
Compare
This doesn't work for old scb files (as you can tell, from the test!) It should... |
4312f07
to
51d0031
Compare
51d0031
to
8c67b5a
Compare
This change will allow subtypes in wiregen files to have tlvstreams. Shifting tlv structs above subtypes in header_template is done to prevent forward declaration. Since generate-wire prepends 'tlv_' in tlvname, we have to modify fromwire_subtype_field and towire_subtype_field in impl_template to accommodate this.
abaf48b
to
1ca3c9b
Compare
…rgencyrecover to create penalty txn when peer publishes an old revoked state.
…chan() - Added field to store commitment secret chain in - Added field to hold counterparty's basepoint information - Added field to indicate the channel initiator's side (local or remote) These fields enhance to make channels which are capable to create penalty transaction in case the peer broadcasts an old revoked state.
…directly to the database - Adds 'wallet_stub_shachain_init' function to store a retrieved shachain in the database. - Saves initial metadata ('min_index' and 'num_valid') to the 'shachains' table. - Iterates through known shachain secrets, adding each entry to 'shachain_known' with position, index, and hash. This function enables direct persistence of shachain data, ensuring all relevant information is saved upon retrieval.
…mergency.recover using staticbackup RPC
…pdate emergency.recover everytime we get a revocation secret.
Add test to check if we can successfully create a penalty transaction when we recover a channel using emergencyrecover and the peer publishes an old state. Changelog-Added: Now the emergency.recover file would keep track of all the revocation secrets when any channel advances it's state.
1ca3c9b
to
e20a2c3
Compare
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.
seems like a sensible and reasonable change. the commits were very easy to read through, kudos on that!
very cool that we're basically turning peers into watchtowers for ourselves.
#include <common/wireaddr.h> | ||
#include <common/channel_type.h> | ||
#include <common/derive_basepoints.h> |
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.
nit: list these alphabetically?
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.
for commit 53b16a0, it looks like a keyword got omitted from the commit message
@@ -1465,9 +1469,13 @@ static struct channel *stub_chan(struct command *cmd, | |||
struct pubkey localFundingPubkey; | |||
struct pubkey pk; | |||
struct short_channel_id *scid; | |||
u32 blockht; | |||
u32 blockht = 0; |
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.
why set this here? it doesn't look like it got used again in this commit
@@ -2368,6 +2368,8 @@ static void json_add_scb(struct command *cmd, | |||
{ | |||
u8 *scb = tal_arr(cmd, u8, 0); | |||
|
|||
// Update shachain in SCB. |
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.
nit: comments are of form /* Update shachain in SCB. */
@@ -1013,6 +1013,9 @@ void tell_connectd_peer_importance(struct peer *peer UNNEEDED, | |||
/* Generated stub for tlv_hsmd_dev_preinit_tlvs_new */ | |||
struct tlv_hsmd_dev_preinit_tlvs *tlv_hsmd_dev_preinit_tlvs_new(const tal_t *ctx UNNEEDED) | |||
{ fprintf(stderr, "tlv_hsmd_dev_preinit_tlvs_new called!\n"); abort(); } | |||
/* Generated stub for tlv_scb_tlvs_new */ | |||
struct tlv_scb_tlvs *tlv_scb_tlvs_new(const tal_t *ctx UNNEEDED) |
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.
nit: squash this into the commit that adds this new method!
This PR would enable nodes to create penalty transaction when the peer publishes an old revoked state using the emergency.recover.
Addresses: #7696