Raven Core  3.0.0
P2P Digital Currency
feebumper.h
Go to the documentation of this file.
1 // Copyright (c) 2017 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef RAVEN_WALLET_FEEBUMPER_H
7 #define RAVEN_WALLET_FEEBUMPER_H
8 
10 
11 class CWallet;
12 class CWalletTx;
13 class uint256;
14 class CCoinControl;
15 enum class FeeEstimateMode;
16 
17 enum class BumpFeeResult
18 {
19  OK,
24  MISC_ERROR,
25 };
26 
28 {
29 public:
30  CFeeBumper(const CWallet *pWalletIn, const uint256 txidIn, const CCoinControl& coin_control, CAmount totalFee);
31  BumpFeeResult getResult() const { return currentResult; }
32  const std::vector<std::string>& getErrors() const { return vErrors; }
33  CAmount getOldFee() const { return nOldFee; }
34  CAmount getNewFee() const { return nNewFee; }
35  uint256 getBumpedTxId() const { return bumpedTxid; }
36 
37  /* signs the new transaction,
38  * returns false if the tx couldn't be found or if it was
39  * impossible to create the signature(s)
40  */
41  bool signTransaction(CWallet *pWallet);
42 
43  /* commits the fee bump,
44  * returns true, in case of CWallet::CommitTransaction was successful
45  * but, eventually sets vErrors if the tx could not be added to the mempool (will try later)
46  * or if the old transaction could not be marked as replaced
47  */
48  bool commit(CWallet *pWalletNonConst);
49 
50 private:
51  bool preconditionChecks(const CWallet *pWallet, const CWalletTx& wtx);
52 
53  const uint256 txid;
56  std::vector<std::string> vErrors;
60 };
61 
62 #endif // RAVEN_WALLET_FEEBUMPER_H
BumpFeeResult currentResult
Definition: feebumper.h:57
const uint256 txid
Definition: feebumper.h:53
FeeEstimateMode
Definition: fees.h:98
std::vector< std::string > vErrors
Definition: feebumper.h:56
uint256 bumpedTxid
Definition: feebumper.h:54
Coin Control Features.
Definition: coincontrol.h:17
CAmount getOldFee() const
Definition: feebumper.h:33
CAmount nNewFee
Definition: feebumper.h:59
int64_t CAmount
Amount in corbies (Can be negative)
Definition: amount.h:13
uint256 getBumpedTxId() const
Definition: feebumper.h:35
const std::vector< std::string > & getErrors() const
Definition: feebumper.h:32
CAmount nOldFee
Definition: feebumper.h:58
A transaction with a bunch of additional info that only the owner cares about.
Definition: wallet.h:285
256-bit opaque blob.
Definition: uint256.h:123
BumpFeeResult getResult() const
Definition: feebumper.h:31
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:673
CMutableTransaction mtx
Definition: feebumper.h:55
A mutable version of CTransaction.
Definition: transaction.h:389
CAmount getNewFee() const
Definition: feebumper.h:34
BumpFeeResult
Definition: feebumper.h:17