bitcoinjs / bitcoinjs-lib

A javascript Bitcoin library for node.js and browsers.
MIT License
5.71k stars 2.11k forks source link

[Question]: Mempool Conflict Error #2129

Closed crypmancer closed 4 months ago

crypmancer commented 4 months ago

I can't complete my psbt with this error.

error: { code: -26, message: '258: txn-mempool-conflict' },

How to solve this problem?

samholmes commented 4 months ago

From what I know, this message comes from the RPC node responding with the error message which says that the transaction being broadcasts conflicts with another transaction which exists in the mempool. This happens when your transaction attempts to use a UTXO that has already be included as an input for another transaction already broadcast; essentially a double spend.

The only way to fix this is with RBF.

junderw commented 4 months ago

If this is intentional (You want to replace an already spent UTXO): Use RBF.

If this is unintentional: The place you are getting your UTXO information is bad, OR you are performing transactions too quickly for the API you're using while not accounting for self-spent UTXOs, so you're accidentally spending the same UTXO twice.