Skip to content

Commit 21e1a4a

Browse files
mrbandrewsPastaPastaPasta
authored andcommitted
partial Merge bitcoin#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
1 parent b64081b commit 21e1a4a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/wallet/wallet.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,13 @@ std::set<uint256> CWallet::GetConflicts(const uint256& txid) const
495495
return result;
496496
}
497497

498+
bool CWallet::HasWalletSpend(const uint256& txid) const
499+
{
500+
AssertLockHeld(cs_wallet);
501+
auto iter = mapTxSpends.lower_bound(COutPoint(txid, 0));
502+
return (iter != mapTxSpends.end() && iter->first.hash == txid);
503+
}
504+
498505
void CWallet::Flush()
499506
{
500507
GetDatabase().Flush();

src/wallet/wallet.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,9 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
11901190
//! Get wallet transactions that conflict with given transaction (spend same outputs)
11911191
std::set<uint256> GetConflicts(const uint256& txid) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
11921192

1193+
//! Check if a given transaction has any of its outputs spent by another transaction in the wallet
1194+
bool HasWalletSpend(const uint256& txid) const;
1195+
11931196
//! Flush wallet (bitdb flush)
11941197
void Flush();
11951198

0 commit comments

Comments
 (0)