-
Notifications
You must be signed in to change notification settings - Fork 912
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
Watchtowers attempt 3: the full channelding #3659
Conversation
0e31bcf
to
ea49d81
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.
Some commit order issues (I don't think this will bisect?), and one minor possible cleanup with I can append separately.
I think I'll try to reorder the commits myself to save another round-trip!
msg = wire_sync_read(tmpctx, HSM_FD); | ||
if (!msg || !fromwire_hsm_sign_tx_reply(msg, &sig)) { | ||
status_broken("Reading sign_tx_reply: %s", tal_hex(tmpctx, msg)); | ||
abort(); |
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.
status_failed(STATUS_FAIL_HSM_IO, ....
lightningd/peer_htlcs.c
Outdated
static void | ||
commitment_revocation_hook_cb(struct commitment_revocation_payload *p, | ||
const char *buffer, const jsmntok_t *toks){ | ||
commitment_revocation_hook_cb(struct commitment_revocation_payload *p STEALS){ | ||
wallet_penalty_base_delete(p->wallet, p->channel_id, p->commitnum); | ||
} | ||
|
||
REGISTER_PLUGIN_HOOK(commitment_revocation, PLUGIN_HOOK_CHAIN, | ||
static bool | ||
commitment_revocation_hook_deserialize(struct commitment_revocation_payload *p, | ||
const char *buffer, | ||
const jsmntok_t *toks) | ||
{ | ||
return true; | ||
} | ||
|
||
|
||
REGISTER_PLUGIN_HOOK(commitment_revocation, | ||
commitment_revocation_hook_deserialize, | ||
commitment_revocation_hook_cb, | ||
struct commitment_revocation_payload *, | ||
commitment_revocation_hook_serialize, | ||
struct commitment_revocation_payload *); |
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.
This looks like a fixup for the previous commit, not part of pytest: Add a test for the commitment_revocation hook
?
lightningd/peer_htlcs.c
Outdated
plugin_hook_call_commitment_revocation(ld, payload, payload); | ||
plugin_hook_call_commitment_revocation(ld, payload); | ||
} |
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.
This too...
Suggested-by: Rusty Russell <@rustyrussell>
We need the txs around, so don't throw them away after generating them.
`lightningd` passes in all the known penalty_bases when starting a new `channeld` instance, which tracks them internally, eventually matching them with revocations and passing them back to `lightningd` so it can create the penalty transaction. From here it is just a small step to having `channeld` also generate the penalty transaction if desired.
`channeld` will start creating the penalty transactions in one of the next commits, so it should know the penalty feerate.
Changelog-Added: plugin: Added a new `commitment_revocation` hook that provides the plugin with penalty transactions for all revoked transactions.
OK, I rebased to avoid the (trivial) conflicts and reordered commits so it compiles and passes tests at all points. |
Ack af88a72 |
This is the third variant of the watchtower hook, the channelding. The main
difference with respect to #3645 is that the penalty transaction is now
created by
channeld
which already has a contextualized connection tohsmd
,so we can now drop the changes to the
hsmd
wire protocol, and just add thepenalty creation capability to the connection between
hsmd
andchanneld
. It also removes the need to synchronously talk to thehsmd
fromlightningd
which was a bit ugly.Closes #3601
Closes #3645
Fixes #3422
Fixes #1353