Skip to content

Double Spend Proof (dsproof-beta)

freetrader requested to merge freetrader/bitcoin-cash-node:dsproof_resume into master

Double Spend Proofs

This MR resumes work from !700 (closed) and !751 (closed).

Test plan:

  • run unit tests + extended functional tests (ninja all check check-functional-extended)
  • run the benchmark test plan from 308c8d26
  • run the fuzzing test plan (cmake only) from cc5b98f7
  • review docs

The original MR !700 (closed) description is below.

The specification as it is now; spec

The double spend proof code detects double spends, sends an INV to peers and handles getdata requests by introducing a new 'dsproof-beta' message.

This adds a DoubleSpendProof and a DoubleSpendProofStorage set of classes which are as you'd expect. The storage is owned by the mempool and the mempool will delete DSPs from the DSPStorage as the transaction they belong to go away (for instance if they are mined). The link between a transaction in the mempool and its proof are by the addition of the dsproof int in the CTxMemPoolEntry class.

Known issue: the code currently only manages to create DSPs when the UTXO it double spends is a p2pkh. This helps for the majority of the cases on the net, but this issue is the main reason we have the name 'beta' in the message name. The current message structure might just work for this, but lets get something deployed and tested in wallets first, ok? The second reason for calling it 'beta' is because I don't pretend to be a genius that can predict the issues we get when this is deployed and PoS systems start using this. Again, lets get this deployed first :)

Merge instructions:


(This has already been squashed down from )

Edited by freetrader

Merge request reports