Skip to content

[Splice] Should abort if received tx_add_input for the shared input and prevtx is not empty #8030

@remyers

Description

@remyers

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 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.

			/* 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions