Track and report wallet transaction clones

Adds a "walletconflicts" array to transaction info; if
a wallet transaction is mutated, the alternate transaction id
or ids are reported there (usually the array will be empty).

Metadata from the original transaction is copied to the mutant,
so the transaction time and "from" account of the mutant are
reported correctly.
This commit is contained in:
Gavin Andresen
2014-02-13 20:12:51 -05:00
parent 9a3d936fc2
commit 731b89b8b5
5 changed files with 128 additions and 9 deletions

View File

@@ -88,8 +88,10 @@ B2ADDRESS=$( $CLI $B2ARGS getnewaddress )
# Have B1 create two transactions; second will
# spend change from first, since B1 starts with only a single
# 50 bitcoin output:
TXID1=$( $CLI $B1ARGS sendtoaddress $B2ADDRESS 1.0 )
TXID2=$( $CLI $B1ARGS sendtoaddress $B2ADDRESS 2.0 )
$CLI $B1ARGS move "" "foo" 10.0
$CLI $B1ARGS move "" "bar" 10.0
TXID1=$( $CLI $B1ARGS sendfrom foo $B2ADDRESS 1.0 0)
TXID2=$( $CLI $B1ARGS sendfrom bar $B2ADDRESS 2.0 0)
# Mutate TXID1 and add it to B2's memory pool:
RAWTX1=$( $CLI $B1ARGS getrawtransaction $TXID1 )
@@ -122,7 +124,9 @@ echo "Mutated: " $MUTATEDTXID
$CLI $B2ARGS addnode 127.0.0.1:11000 onetry
WaitPeers "$B1ARGS" 1
$CLI $B2ARGS setgenerate true 1
$CLI $B2ARGS setgenerate true 3
WaitBlocks
$CLI $B1ARGS setgenerate true 3
WaitBlocks
$CLI $B2ARGS stop > /dev/null 2>&1