channeld: tell lightningd about local anchor for each commitment tx.

It's going to want to remember these, in case it encounters peers'
commitment tx and needs to boost it with CPFP on the anchor.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-10-26 13:03:28 +10:30
parent 01d31e7dde
commit e609bc934e
7 changed files with 92 additions and 33 deletions

View File

@@ -270,6 +270,7 @@ int main(int argc, char *argv[])
const struct channel_type *channel_type;
struct sha256_double hash;
u32 blockheight = 0;
int local_anchor_outnum;
setup_locale();
chainparams = chainparams_for_network("bitcoin");
@@ -425,7 +426,7 @@ int main(int argc, char *argv[])
local_txs = channel_txs(NULL, &channel->funding, channel->funding_sats,
&htlcmap, NULL, &funding_wscript, channel,
&local_per_commit_point, commitnum,
LOCAL, 0, 0);
LOCAL, 0, 0, &local_anchor_outnum);
printf("## local_commitment\n"
"# input amount %s, funding_wscript %s, pubkey %s\n",
@@ -536,7 +537,7 @@ int main(int argc, char *argv[])
remote_txs = channel_txs(NULL, &channel->funding, channel->funding_sats,
&htlcmap, NULL, &funding_wscript, channel,
&remote_per_commit_point, commitnum,
REMOTE, 0, 0);
REMOTE, 0, 0, &local_anchor_outnum);
printf("## remote_commitment\n"
"# input amount %s, funding_wscript %s, key %s\n",