aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/feebumper.h
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2017-03-03 16:15:47 +0100
committerJonas Schnelli <dev@jonasschnelli.ch>2017-04-02 10:12:39 +0200
commit0337a39d31603eb2c723a560410357f186763dc2 (patch)
tree82076d4859da26c9bb890538acedcbbc232f6ac6 /src/wallet/feebumper.h
parentd1a95e8d3d0ac58792fe1b885c9fc65af11d7691 (diff)
Refactor Bumpfee core functionality
Diffstat (limited to 'src/wallet/feebumper.h')
-rw-r--r--src/wallet/feebumper.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/wallet/feebumper.h b/src/wallet/feebumper.h
new file mode 100644
index 0000000000..42b0ccad36
--- /dev/null
+++ b/src/wallet/feebumper.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2017 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#ifndef BITCOIN_WALLET_FEEBUMPER_H
+#define BITCOIN_WALLET_FEEBUMPER_H
+
+#include <primitives/transaction.h>
+
+class CWallet;
+class uint256;
+
+enum class BumpFeeResult
+{
+ OK,
+ INVALID_ADDRESS_OR_KEY,
+ INVALID_REQUEST,
+ INVALID_PARAMETER,
+ WALLET_ERROR,
+ MISC_ERROR,
+};
+
+class CFeeBumper
+{
+public:
+ CFeeBumper(const CWallet *pWalletIn, const uint256 txidIn, int newConfirmTarget, bool specifiedConfirmTarget, CAmount totalFee, bool newTxReplaceable);
+ BumpFeeResult getResult() const { return currentResult; }
+ const std::vector<std::string>& getErrors() const { return vErrors; }
+ CAmount getOldFee() const { return nOldFee; }
+ CAmount getNewFee() const { return nNewFee; }
+ CMutableTransaction* getBumpedTxRef() { return &mtx; }
+ uint256 getBumpedTxId() const { return bumpedTxid; }
+
+ bool commit(CWallet *pWalletNonConst);
+
+private:
+ const uint256 txid;
+ uint256 bumpedTxid;
+ CMutableTransaction mtx;
+ std::vector<std::string> vErrors;
+ BumpFeeResult currentResult;
+ CAmount nOldFee;
+ CAmount nNewFee;
+};
+
+#endif // BITCOIN_WALLET_FEEBUMPER_H