-
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
[Splice] Should abort if received tx_add_input
for the shared input and prevtx
is not empty
#8030
Comments
Ah that makes total sense. Great find.
…On Thu, Jan 23, 2025 at 11:10 AM Richard Myers ***@***.***> wrote:
The code below from interactivetx.c
<https://github.com/ElementsProject/lightning/blob/305c3779856889bc498fb4f232115997eb0d7fa4/common/interactivetx.c#L483>
enforces the interactive-tx handling rule
<https://github.com/lightning/bolts/blob/aece0d8f42310d7e7d128905cf18eb0414c02459/02-peer-protocol.md#the-tx_add_input-message-2>
that if the receiving node sets tlvs->shared_input_txid, then it must
match the txid of the shared input. But it does not fail when
tlvs->shared_input_txid is not set, but ictx->shared_outpoint is the same
as the added shared input and prevtx has been set.
A check must be made when prevtx is set to make sure when adding the
shared output, prevtx has not been set. We do this in Eclair here
<https://github.com/ACINQ/eclair/blob/3249f2b6077564030411c27d20ac08b30e0e2545/eclair-core/src/main/scala/fr/acinq/eclair/channel/fund/InteractiveTxBuilder.scala#L549>
.
/* For our shared input only, we will fill in prevtx */
if (ictx->shared_outpoint && tlvs->shared_input_txid) {
if (!bitcoin_txid_eq(tlvs->shared_input_txid,
&ictx->shared_outpoint->txid))
return tal_fmt(ctx, "funding_txid value"
" %s unrecognized."
" Should be %s",
fmt_bitcoin_txid(ctx, tlvs->shared_input_txid),
fmt_bitcoin_txid(ctx, &ictx->shared_outpoint->txid));
if (!ictx->funding_tx)
return tal_fmt(ctx, "Internal error"
" did not set"
" interactivetx"
" funding_tx");
tx = ictx->funding_tx;
}
I found this missing check while investigating why during interop testing
Eclair is returning InvalidSharedInput when clightning initiates the
splice. If I can confirm clightning is sending an add_tx_input with
prevtx set for the shared input, I'll link a new issue.
cc: @ddustin <https://github.com/ddustin>
—
Reply to this email directly, view it on GitHub
<#8030>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACQ5F747O6KP6OQ675SZHT2MEH7DAVCNFSM6AAAAABVXWZ5WKVHI2DSMVQWIX3LMV43ASLTON2WKOZSHAYDOMZRHA2DQMY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Added a PR for the stricter conditions on the peer
There are only two instances where One is when the The code looks like it's sending lightning/common/interactivetx.c Lines 236 to 238 in 305c377
The other code sends prevtx bytes and sends no tlv lightning/common/interactivetx.c Lines 240 to 242 in 305c377
In my reading of the code I can't see any way it would ever send both. |
It looks like the problem is that Where it says "Adding splice input" it's taking the 2nd branch where it adds From what I can see, the These are the commands I used to produce this: $ export PSBT_SPLICE_INIT=$(bob-clightning-cli splice_init $CHANNEL_ID 100001 | jq -r '.psbt')
$ bob-clightning-cli splice_update $CHANNEL_ID $PSBT_SPLICE_INIT
{
"code": 362,
"message": "Peer aborted for reason: ABORT channel dd468a1bd8dedbaabb90f5aff0f8f6ab63cb37c94623773729b2366af7a0ced2: invalid shared tx_add_input (serial_id=d7a14a9d1dc9756a)"
} If I fix the code so that struct tlv_tx_add_input_tlvs *tlvs = tal(tmpctx, struct tlv_tx_add_input_tlvs); and replace it with: struct tlv_tx_add_input_tlvs *tlvs = tlv_tx_add_input_tlvs_new(tmpctx); That get's me farther, but the next line in the script fails: $ bob-clightning-cli signpsbt -k psbt="$PSBT_SPLICE_UPDATE"
{
"code": -1,
"message": "No wallet inputs to sign"
} I'll hand it back to you to debug that, perhaps my testing script is incorrect? I thought I followed the man page. |
The code below from interactivetx.c enforces the interactive-tx handling rule that if the receiving node sets
tlvs->shared_input_txid
, then it must match the txid of the shared input. But it does not fail whentlvs->shared_input_txid
is not set, butictx->shared_outpoint
is the same as the added shared input andprevtx
has been set.A check must be made when
prevtx
is set to make sure when adding the shared output,prevtx
has not been set. We do this in Eclair here.I found this missing check while investigating why during interop testing Eclair is returning
InvalidSharedInput
when clightning initiates the splice. If I can confirm clightning is sending anadd_tx_input
with prevtx set for the shared input, I'll link a new issue.cc: @ddustin
The text was updated successfully, but these errors were encountered: