-
Notifications
You must be signed in to change notification settings - Fork 1
Fixed splice_locked messgae to include splice_txid field and other interop fixes #6
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -227,19 +227,30 @@ static char *send_next(const tal_t *ctx, | |
|
|
||
| /* If this the shared channel input, we send funding txid in | ||
| * in tlvs and do not send prevtx */ | ||
| status_info("ictx->shared_outpoint = %s",(ictx->shared_outpoint?"defined":"null")); | ||
| char txid_hex[65]; | ||
| if (ictx->shared_outpoint && bitcoin_txid_to_hex(&(ictx->shared_outpoint->txid), txid_hex, sizeof(txid_hex))) { | ||
| status_info("ictx->shared_outpoint->txid=%s, ictx->shared_outpoint->n=%d", txid_hex, ictx->shared_outpoint->n); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should use For example: if (!bitcoin_txid_eq(&signed_psbt_txid, ¤t_psbt_txid))
status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Signed PSBT txid %s does not match"
" current_psbt_txid %s",
fmt_bitcoin_txid(tmpctx, &signed_psbt_txid),
fmt_bitcoin_txid(tmpctx, ¤t_psbt_txid)); |
||
| } | ||
| if (bitcoin_txid_to_hex(&(point.txid), txid_hex, sizeof(txid_hex))) { | ||
| status_info("point.txid=%s, point.n=%d", txid_hex, point.n); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| status_info("here2"); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would cut this log statement |
||
| if (ictx->shared_outpoint | ||
| && bitcoin_outpoint_eq(&point, ictx->shared_outpoint)) { | ||
| struct tlv_tx_add_input_tlvs *tlvs = tal(tmpctx, struct tlv_tx_add_input_tlvs); | ||
| struct tlv_tx_add_input_tlvs *tlvs = tlv_tx_add_input_tlvs_new(tmpctx); | ||
| tlvs->shared_input_txid = tal_dup(tlvs, | ||
| struct bitcoin_txid, | ||
| &point.txid); | ||
| status_info("Adding shared input %s", tal_hexstr(ctx, &serial_id, sizeof(serial_id))); | ||
| msg = towire_tx_add_input(NULL, cid, serial_id, | ||
| NULL, in->input.index, | ||
| in->input.sequence, tlvs); | ||
| } else { | ||
| msg = towire_tx_add_input(NULL, cid, serial_id, | ||
| prevtx, in->input.index, | ||
| in->input.sequence, NULL); | ||
| status_info("Adding splice input %s", tal_hexstr(ctx, &serial_id, sizeof(serial_id))); | ||
| } | ||
|
|
||
| tal_arr_remove(&set->added_ins, 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.
This should be
&peer->splice_state->locked_txid-- however this value is not preserved after channel restarts, so that needs to addressed as well.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 is a bit of a heavy lift. I think this is the best way to make
splice_state->locked_txidwork over restarts.{SQL("ALTER TABLE channel_funding_inflights ADD locked_onchain BOOL DEFAULT 0"), NULL},to db.c at the end of the db table be able to mark an inflight locked onchainis_lockedwithinflight->is_locked = fromwire_bool(cursor, max);infromwire_inflightandtowire_bool(pptr, inflight->is_locked);in towire_inflight.channeld_updating_inflightto include anis_lockedparameterhandle_update_inflightto takeis_lockedparameter and update that value in its inflightwallet_inflight_saveSQL query to saveis_lockedto the databasewallet_channel_load_inflightsto load `is_locked from the databasetowire_channeld_initto addis_lockedto theinfcopyfromwire_channeld_init, loop through each inflight inpeer->splice_state->inflightsand get the txid from the psbt of the one thatis_locked, placing it in peer->splice_state->locked_txid. Additionally it would be useful to assert only 1 is locked as two would be an error.I thiiiiink that would do it.
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.
I can't really comment on if that's the right approach. Do you need to use
splice_state->locked_txidduring reconnect? It should already be your latest funding tx once you have sent and receivedsplice_locked. If it has reached acceptable depth then your node can resendsplice_lockedwith the txid of the latest funding tx. You must have already have saved that information after you exchangedsplice_lockedwith your peer.However, when you do a reconnect before exchanging
splice_lockedI can see that you'll need to save the txid of the funding tx negotiated for the splice. We save this information with the splice commitment along with the signatures exchanged.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.
Yes you're right,
peer->channel->funding.txidis correct in this case.There needs to be a new separate case that uses
peer->splice_state->locked_txidthat I'm working on at the moment.