bitcoin/bitcoin — pull request #2596 by jevonx (2013-04-30 14:31:09+00:00)
Title: Watch for double spends of wallet transactions

This pull adds ScanForDoubleSpends to check incoming transactions for double spends of wallet transactions.

Flagged wallet transactions give the following warnings:
1) in RPC the transaction gets the "doublespend" property
2) todo later: Qt should highlight it as a possible fraud attempt
3) confirmations is held at 0 for 200 blocks to keep it from being spent

The 200 block hold is a protection against double spends during forks. The client is normally oblivious to double spends in other forks because it only looks at the fork its on. ScanForDoubleSpends can compensate for that weakness because it can detect double spends from other forks and put at-risk transactions on hold.