partial Merge #8456: [RPC] Simplified bumpfee command.

It includes only this commit for sake of backporting HasWalletSpent

[RPC] bumpfee

This command allows a user to increase the fee on a wallet transaction T, creating a "bumper" transaction B.
T must signal that it is BIP-125 replaceable.
T's change output is decremented to pay the additional fee.  (B will not add inputs to T.)
T cannot have any descendant transactions.
Once B bumps T, neither T nor B's outputs can be spent until either T or (more likely) B is mined.

Includes code by @jonasschnelli and @ryanofsky
This commit is contained in:
mrbandrews 2016-12-09 13:45:27 -05:00 committed by pasta
parent b64081bf3d
commit 21e1a4a881
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
2 changed files with 10 additions and 0 deletions

View File

@ -495,6 +495,13 @@ std::set<uint256> CWallet::GetConflicts(const uint256& txid) const
return result;
}
bool CWallet::HasWalletSpend(const uint256& txid) const
{
AssertLockHeld(cs_wallet);
auto iter = mapTxSpends.lower_bound(COutPoint(txid, 0));
return (iter != mapTxSpends.end() && iter->first.hash == txid);
}
void CWallet::Flush()
{
GetDatabase().Flush();

View File

@ -1190,6 +1190,9 @@ public:
//! Get wallet transactions that conflict with given transaction (spend same outputs)
std::set<uint256> GetConflicts(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
//! Check if a given transaction has any of its outputs spent by another transaction in the wallet
bool HasWalletSpend(const uint256& txid) const;
//! Flush wallet (bitdb flush)
void Flush();