-
Notifications
You must be signed in to change notification settings - Fork 913
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
dual-funding: final final final final?? #6391
dual-funding: final final final final?? #6391
Conversation
0d6d5d6
to
92e8df4
Compare
We're adding signed types to the spec! This adds the support mechanisms for them.
the witnesses are maddeningly weird now (you concat everything together) we also changed some things to be s64's (it's a teeny tiny change)
As per lightning/bolts@cd3c99e we should send the next_funding_txid if we've sent our commitment sigs, but we haven't received the peer's tx_signatures. Note that we send here, but don't verify that it's arrived.
92e8df4
to
c235f60
Compare
*/ | ||
tlvs = tlv_channel_reestablish_tlvs_new(tmpctx); | ||
if (!tx_state->remote_funding_sigs_rcvd) | ||
tlvs->next_funding = &tx_state->funding.txid; |
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.
Would it make sense to tal_steal
or tal
a copy onto tlvs
? Just so we don't accidentally free the pointee.
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.
Definitely about time other implementations start looking at DF!
ACK c235f60
const u8 *data = witness->witness_data; | ||
size_t size, max = tal_count(data); | ||
bool ok; | ||
|
||
wally_tx_witness_stack_free(in->final_witness); | ||
|
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.
@niftynei @rustyrussell You need to set this to NULL
after freeing it, otherwise if line 72 returns you have a dangling pointer and potential later use-after-free here. Alternately use wally_psbt_set_input_final_witness(NULL)
which will free any existing witness and set the value to NULL
.
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.
Thanks for the note! Just added a PR to fix this.
@niftynei wally now exposes witness se/serialization using the psbt-spec format as used here: #6882 specifically fedfe6f If I understand your change now uses that same serialization format? If so then your manual serialization can be removed once that PR is rebased and merged (has tal issues I need to look at in the last 2 commits). |
What if we finished off the dual-funding spec??
This PR adds/updates the following. Note that it's missing/still needs the check for the
next_funding_txid
, which I'm hoping to get up soon ™️ .funding_contribution
from an unsigned to a signed int. This is future-proofing for a world where splicing exists.next_funding_txid
if we remember the peer on reconnect + haven't received their tx-sigs yet. Needs a little bit of work.