diff options
author | Alex Morcos <morcos@chaincode.com> | 2016-01-07 16:31:12 -0500 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-01-13 15:55:00 +0100 |
commit | fd4bd5009eed5235c9afb6dc2e7e095a8bdd8c0b (patch) | |
tree | a6e6fe9948f8fbf1e52adaa383d9e25993045a3e /src/wallet/wallet.h | |
parent | 2c5c2154c935380c7dbca26ec90d9395d43c4ccf (diff) | |
download | bitcoin-fd4bd5009eed5235c9afb6dc2e7e095a8bdd8c0b.tar.xz |
Add RPC call abandontransaction
- Make wallet descendant searching more efficient
- Add new rpc call: abandontransaction
Unconfirmed transactions that are not in your mempool either due to eviction or other means may be unlikely to be mined. abandontransaction gives the wallet a way to no longer consider as spent the coins that are inputs to such a transaction. All dependent transactions in the wallet will also be marked as abandoned.
- Add RPC test for abandoned and conflicted transactions.
- [Wallet] Call notification signal when a transaction is abandoned
Github-Pull: #7312
Rebased-From: 9e697172542e2b01517e4025df2c23d0ed5447f4 01e06d1fa365cedb7f5d5e17e6bdf0b526e700c5 df0e2226d998483d247c0245170f6b8ff6433b1d d11fc1695c0453ef22a633e516726f82717dd1d9
Diffstat (limited to 'src/wallet/wallet.h')
-rw-r--r-- | src/wallet/wallet.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 89fc17bc74..df417fef42 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -157,6 +157,10 @@ struct COutputEntry /** A transaction with a merkle branch linking it to the block chain. */ class CMerkleTx : public CTransaction { +private: + /** Constant used in hashBlock to indicate tx has been abandoned */ + static const uint256 ABANDON_HASH; + public: uint256 hashBlock; @@ -208,6 +212,9 @@ public: bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet) > 0; } int GetBlocksToMaturity() const; bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectAbsurdFee=true); + bool hashUnset() const { return (hashBlock.IsNull() || hashBlock == ABANDON_HASH); } + bool isAbandoned() const { return (hashBlock == ABANDON_HASH); } + void setAbandoned() { hashBlock = ABANDON_HASH; } }; /** @@ -487,7 +494,6 @@ private: /* Mark a transaction (and its in-wallet descendants) as conflicting with a particular block. */ void MarkConflicted(const uint256& hashBlock, const uint256& hashTx); - void SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator>); public: @@ -785,6 +791,9 @@ public: bool GetBroadcastTransactions() const { return fBroadcastTransactions; } /** Set whether this wallet broadcasts transactions. */ void SetBroadcastTransactions(bool broadcast) { fBroadcastTransactions = broadcast; } + + /* Mark a transaction (and it in-wallet descendants) as abandoned so its inputs may be respent. */ + bool AbandonTransaction(const uint256& hashTx); }; /** A key allocated from the key pool. */ |