Fix simple close checks - #9417
Conversation
And fix prototypes which caused mocks to break. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
cf1ed1e to
a558e14
Compare
We're going to need it if lightningd wants to double-check the tx it gets from simpleclosed. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
From lightningd's perspective, there are two messages: 1. We got a signature on our closing tx. 2. We got a signature on their closing tx. The closer/closee naming is confusing. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
simpleclosed checks it, but for thoroughness (and to prevent bugs and avoid any potential exploits in it) we need to check it too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We want our own closing tx, but theirs might be too low-fee to use. Broadcast it, as a courtesy, but don't *rely* on it! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-EXPERIMENTAL: `experimental-simple-close` now doesn't save peer's closing transaction, so it can't be stuck with a too-low-fee tx.
a558e14 to
8e22298
Compare
| # find both in any order rather than two sequential wait_for_log calls. | ||
| l1.daemon.wait_for_logs(['Simple close: stored closer tx', | ||
| 'Simple close: stored closee tx']) | ||
| 'Simple close: broadcast closee tx']) |
There was a problem hiding this comment.
As i see simple_close_control.c now logs "Simple close: stored our tx" and "Simple close: broadcast their tx". And test_simple_close_closee_only below, at line 4424 and 4426 got the rename right
|
|
||
| const char *err = close_tx_check(tmpctx, channel, tx); | ||
| const char *err = close_tx_check(tmpctx, channel, tx, | ||
| feerate_for_close(channel)); |
There was a problem hiding this comment.
feerate_for_close() is called here to derive max_feerate_wepay, but it's also called once earlier in peer_start_simpleclosed() to set the feerate that simpleclosed actually builds the tx with. Between those two calls, mutual_close_feerate() can change - update_feerates runs on a timer independent of blocks (poll_seconds defaults to 30s), and peer_start_simpleclosed isnt re-invoked while we're waiting on the peers closing_sig. Should the actual feerate used by simpleclosed be passed back through the wire message instead of recomputed here?
It's still an experimental option, but two fixes:
The first was found by our internal LLM-assisted scanning. The second was found by me when fixing the first.