bitcoin-sv / ts-sdk

Other
51 stars 12 forks source link

ARCO-142: add competing txs to broadcast response #117

Closed pawellewandowski98 closed 2 months ago

pawellewandowski98 commented 3 months ago

Description of Changes

Added competingTxs to BroadcastResponse, they are sent if double spend was attempted.

Linked Issues / Tickets

ARCO-142

Testing Procedure

Describe the tests you've added or any testing steps you've taken.

Checklist:

ty-everett commented 2 months ago

Isn't this a BroadcastFailure?

kuba-4chain commented 2 months ago

It is not, at least not in the way Arc processes transactions. Arc accepts that transaction and keeps track of it, because nodes may accept that transaction into mempool and Arc wants to see which one of the competing transactions will ultimately become MINED and which one(s) will become REJECTED and update the status accordingly.

In most cases, it will obviously be the one seen first by the nodes, but in case two transactions (spending the same UTXO) get accepted by different nodes at exactly the same time, it's up to the nodes to decide.

A broadcast error happens when there is something wrong with the transaction (or broadcast) itself and the nodes will not accept it.