Skip to content

Commit 5f59d3e

Browse files
committed
Improve CFeeBumper interface, add comments, make use of std::move
1 parent 0df22ed commit 5f59d3e

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

src/wallet/feebumper.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *pWal
4242

4343
CFeeBumper::CFeeBumper(const CWallet *pWallet, const uint256 txidIn, int newConfirmTarget, bool specifiedConfirmTarget, CAmount totalFee, bool newTxReplaceable)
4444
:
45-
txid(txidIn),
45+
txid(std::move(txidIn)),
4646
nOldFee(0),
4747
nNewFee(0)
4848
{
@@ -229,6 +229,11 @@ CFeeBumper::CFeeBumper(const CWallet *pWallet, const uint256 txidIn, int newConf
229229
currentResult = BumpFeeResult::OK;
230230
}
231231

232+
bool CFeeBumper::signTransaction(CWallet *pWallet)
233+
{
234+
return pWallet->SignTransaction(mtx);
235+
}
236+
232237
bool CFeeBumper::commit(CWallet *pWallet)
233238
{
234239
AssertLockHeld(pWallet->cs_wallet);

src/wallet/feebumper.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,19 @@ class CFeeBumper
2828
const std::vector<std::string>& getErrors() const { return vErrors; }
2929
CAmount getOldFee() const { return nOldFee; }
3030
CAmount getNewFee() const { return nNewFee; }
31-
CMutableTransaction* getBumpedTxRef() { return &mtx; }
3231
uint256 getBumpedTxId() const { return bumpedTxid; }
3332

33+
/* signs the new transaction,
34+
* returns false if the tx couldn't be found or if it was
35+
* improssible to create the signature(s)
36+
*/
37+
bool signTransaction(CWallet *pWallet);
38+
39+
/* commits the fee bump,
40+
* returns true, in case of CWallet::CommitTransaction was successful
41+
* but, eventually sets vErrors if the tx could not be added to the mempool (will try later)
42+
* or if the old transaction could not be marked as replaced
43+
*/
3444
bool commit(CWallet *pWalletNonConst);
3545

3646
private:

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2895,7 +2895,7 @@ UniValue bumpfee(const JSONRPCRequest& request)
28952895
}
28962896

28972897
// sign bumped transaction
2898-
if (!pwallet->SignTransaction(*feeBump.getBumpedTxRef())) {
2898+
if (!feeBump.signTransaction(pwallet)) {
28992899
throw JSONRPCError(RPC_WALLET_ERROR, "Can't sign transaction.");
29002900
}
29012901
// commit the bumped transaction

0 commit comments

Comments
 (0)