Merge #12079: Improve prioritisetransaction test coverage
[bitcoinplatinum.git] / src / wallet / feebumper.h
blob8eec30440cc7d5b83364ef3e39216c0483f853f6
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 namespace feebumper {
18 enum class Result
20 OK,
21 INVALID_ADDRESS_OR_KEY,
22 INVALID_REQUEST,
23 INVALID_PARAMETER,
24 WALLET_ERROR,
25 MISC_ERROR,
28 //! Return whether transaction can be bumped.
29 bool TransactionCanBeBumped(CWallet* wallet, const uint256& txid);
31 //! Create bumpfee transaction.
32 Result CreateTransaction(const CWallet* wallet,
33 const uint256& txid,
34 const CCoinControl& coin_control,
35 CAmount total_fee,
36 std::vector<std::string>& errors,
37 CAmount& old_fee,
38 CAmount& new_fee,
39 CMutableTransaction& mtx);
41 //! Sign the new transaction,
42 //! @return false if the tx couldn't be found or if it was
43 //! impossible to create the signature(s)
44 bool SignTransaction(CWallet* wallet, CMutableTransaction& mtx);
46 //! Commit the bumpfee transaction.
47 //! @return success in case of CWallet::CommitTransaction was successful,
48 //! but sets errors if the tx could not be added to the mempool (will try later)
49 //! or if the old transaction could not be marked as replaced.
50 Result CommitTransaction(CWallet* wallet,
51 const uint256& txid,
52 CMutableTransaction&& mtx,
53 std::vector<std::string>& errors,
54 uint256& bumped_txid);
56 } // namespace feebumper
58 #endif // BITCOIN_WALLET_FEEBUMPER_H