OSDN Git Service

Handle "conflicted" transactions properly
authormonacoinproject <monacoinproject@gmail.com>
Sun, 6 Apr 2014 15:51:01 +0000 (00:51 +0900)
committermonacoinproject <monacoinproject@gmail.com>
Sun, 6 Apr 2014 15:51:01 +0000 (00:51 +0900)
commitdc8dca4fd4ce421281a292b096ac1c65a9afce6b
tree131535dabf9302d81ecc74ca69103cadce764953
parent6d9b820edea92413d0a6211749db1b5614b977b8
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
qa/rpc-tests/txnmall.sh [new file with mode: 0644]
src/main.cpp
src/main.h
src/qt/transactiondesc.cpp
src/rpcwallet.cpp
src/wallet.cpp
src/wallet.h