Merge #11250: Bump wallet version to 159900 and remove the `usehd` option
[bitcoinplatinum.git] / src / wallet / feebumper.h
blob3d64e53c15c850d4c8e839b0c36ad694eb540385
1 // Copyright (c) 2017 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef BITCOIN_WALLET_FEEBUMPER_H
6 #define BITCOIN_WALLET_FEEBUMPER_H
8 #include <primitives/transaction.h>
10 class CWallet;
11 class CWalletTx;
12 class uint256;
13 class CCoinControl;
14 enum class FeeEstimateMode;
16 enum class BumpFeeResult
18 OK,
19 INVALID_ADDRESS_OR_KEY,
20 INVALID_REQUEST,
21 INVALID_PARAMETER,
22 WALLET_ERROR,
23 MISC_ERROR,
26 class CFeeBumper
28 public:
29 CFeeBumper(const CWallet *pWalletIn, const uint256 txidIn, const CCoinControl& coin_control, CAmount totalFee);
30 BumpFeeResult getResult() const { return currentResult; }
31 const std::vector<std::string>& getErrors() const { return vErrors; }
32 CAmount getOldFee() const { return nOldFee; }
33 CAmount getNewFee() const { return nNewFee; }
34 uint256 getBumpedTxId() const { return bumpedTxid; }
36 /* signs the new transaction,
37 * returns false if the tx couldn't be found or if it was
38 * impossible to create the signature(s)
40 bool signTransaction(CWallet *pWallet);
42 /* commits the fee bump,
43 * returns true, in case of CWallet::CommitTransaction was successful
44 * but, eventually sets vErrors if the tx could not be added to the mempool (will try later)
45 * or if the old transaction could not be marked as replaced
47 bool commit(CWallet *pWalletNonConst);
49 private:
50 bool preconditionChecks(const CWallet *pWallet, const CWalletTx& wtx);
52 const uint256 txid;
53 uint256 bumpedTxid;
54 CMutableTransaction mtx;
55 std::vector<std::string> vErrors;
56 BumpFeeResult currentResult;
57 CAmount nOldFee;
58 CAmount nNewFee;
61 #endif // BITCOIN_WALLET_FEEBUMPER_H