1 Commits

Author SHA1 Message Date
Gavin Andresen
1222b1b59c Handle "conflicted" transactions properly
Extend CMerkleTx::GetDepthInMainChain with the concept of
a "conflicted" transaction-- a transaction generated by the wallet
that is not in the main chain or in the mempool, and, therefore,
will likely never be confirmed.

GetDepthInMainChain() now returns -1 for conflicted transactions
(0 for unconfirmed-but-in-the-mempool, and >1 for confirmed).

This makes getbalance, getbalance '*', and listunspent all agree when there are
mutated transactions in the wallet.

Before:
 listunspent: one 49BTC output
 getbalance: 96 BTC (change counted twice)
 getbalance '*': 46 BTC (spends counted twice)

After: all agree, 49 BTC available to spend.

Conflicts:
	src/qt/walletmodel.cpp
	src/wallet.cpp

Conflicts:
	src/wallet.cpp

Rebased-from: 07986591be1610f3a209f15755dabad14322f16c 0.8.x
2014-04-03 21:59:19 -10:00