You are on the right track. Alice using SIGHASH_ALL | SIGHASH_ANYONECANPAY
allows any other user to add additional inputs to the transaction. However, since Alice’s signature committed to all outputs (due to the SIGHASH_ALL
part), the additional payers cannot change the outputs of the transaction, and their entire input will only contribute to the transaction fees.
Assuming that this new transaction increases the feerate and absolute fee sufficiently to displace the original transaction including any potential descendant transactions, it would invalidate the descendant transaction. Inputs commit to a specific UTXO explicitly per the outpoint (txid:vout
). Since the addition of an input would create a new transaction that has a new TXID, the input to the original’s descendant transaction would cease to be expected to exist and as the original transaction is dropped from the mempool, the descendant would become invalid and be evicted alongside.
Since an input has to commit to exactly one specific UTXO it is spending, there are not "two choices of UTXOs to reference" for the descendant transaction. The recipient of the original/replacement transaction has to recreate the descendant transaction with the new input.
This rule would get an exception if the proposed SIGHASH_ANYPREVOUT
were activated, which allows to identify UTXOs per their output script rather than their outpoint and would allow the recipient to create a descendant transaction that could spend the output of either the original or the replacement transaction.
Follow-up question: How do nodes know which transaction to drop? Why does the descendant transaction not have two different choices what to use as input?
When the original transaction is created, it might have a txid tx_orig
¹. It’s first output (at position 0) then has the outpoint tx_orig:0
. The descendant transaction input spends explicitly spends the UTXO with the outpoint tx_orig:0
. When the replacement transaction with additional inputs is created, it has a different unique txid which might be tx_replace
. Its first output would have the outpoint tx_replace:0
. Therefore, the descendant transaction becomes invalid due to the original transaction becoming replaced.
Transactions are in conflict when at least one UTXO is spent by both transactions. Let’s say there was another previous transaction that created tx_ancient:1
and both the tx_orig
and tx_replace
try to spend that UTXO. The UTXO can only be spent once, so naturally including either transaction excludes the other from ever getting confirmed. Since only one transaction can be picked, miners pick the one that maximizes their reward. They hereby follow the replace-by-fee rules that require the replacement to exceed both the feerate of the original transaction and the absolute fees of all displaced transactions.
¹ In reality txids created by hashing the transaction data with SHA-256, so they are usually presented as 64-character hex strings.