Fabcoin Core  0.16.2
P2P Digital Currency
feebumper.h
Go to the documentation of this file.
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.
4 
5 #ifndef FABCOIN_WALLET_FEEBUMPER_H
6 #define FABCOIN_WALLET_FEEBUMPER_H
7 
9 
10 class CWallet;
11 class CWalletTx;
12 class uint256;
13 class CCoinControl;
14 enum class FeeEstimateMode;
15 
16 enum class BumpFeeResult
17 {
18  OK,
23  MISC_ERROR,
24 };
25 
27 {
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; }
35 
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)
39  */
40  bool signTransaction(CWallet *pWallet);
41 
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
46  */
47  bool commit(CWallet *pWalletNonConst);
48 
49 private:
50  bool preconditionChecks(const CWallet *pWallet, const CWalletTx& wtx);
51 
52  const uint256 txid;
55  std::vector<std::string> vErrors;
59 };
60 
61 #endif // FABCOIN_WALLET_FEEBUMPER_H
BumpFeeResult currentResult
Definition: feebumper.h:56
const uint256 txid
Definition: feebumper.h:52
FeeEstimateMode
Definition: fees.h:96
std::vector< std::string > vErrors
Definition: feebumper.h:55
uint256 bumpedTxid
Definition: feebumper.h:53
uint256 getBumpedTxId() const
Definition: feebumper.h:34
Coin Control Features.
Definition: coincontrol.h:16
CAmount nNewFee
Definition: feebumper.h:58
int64_t CAmount
Amount in lius (Can be negative)
Definition: amount.h:15
CAmount nOldFee
Definition: feebumper.h:57
A transaction with a bunch of additional info that only the owner cares about.
Definition: wallet.h:287
256-bit opaque blob.
Definition: uint256.h:132
CAmount getNewFee() const
Definition: feebumper.h:33
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:672
CMutableTransaction mtx
Definition: feebumper.h:54
BumpFeeResult getResult() const
Definition: feebumper.h:30
A mutable version of CTransaction.
Definition: transaction.h:390
CAmount getOldFee() const
Definition: feebumper.h:32
AddressHash commit(AccountMap const &_cache, SecureTrieDB< Address, DB > &_state)
Definition: State.h:345
BumpFeeResult
Definition: feebumper.h:16
const std::vector< std::string > & getErrors() const
Definition: feebumper.h:31