HomePhabricator

Handle "conflicted" transactions properly
2b72d46f4232Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

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.

Details

Provenance
Gavin Andresen <gavinandresen@gmail.com>Authored on Feb 12 2014, 18:43
schancelPushed on Jan 5 2018, 21:58
schancelPushed on Jan 5 2018, 21:39
schancelPushed on Jan 5 2018, 21:17
Parents
rSTAGINGf582eda4ed0b: Make qa/rpc-tests/ compatible with OSX
Branches
Unknown
Tags
Unknown

Event Timeline

Gavin Andresen <gavinandresen@gmail.com> committed rSTAGING2b72d46f4232: Handle "conflicted" transactions properly (authored by Gavin Andresen <gavinandresen@gmail.com>).Feb 14 2014, 16:08