2020-04-16 13:14:08 -04:00
|
|
|
// Copyright (c) 2017-2020 The Bitcoin Core developers
|
2017-03-03 12:15:47 -03:00
|
|
|
// 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;
|
2017-05-11 04:34:39 -03:00
|
|
|
class CWalletTx;
|
2017-03-03 12:15:47 -03:00
|
|
|
class uint256;
|
2017-06-28 17:23:46 -04:00
|
|
|
class CCoinControl;
|
2017-06-14 15:15:40 -04:00
|
|
|
enum class FeeEstimateMode;
|
2020-04-18 15:18:17 -04:00
|
|
|
struct bilingual_str;
|
2017-03-03 12:15:47 -03:00
|
|
|
|
2017-09-20 17:19:30 -03:00
|
|
|
namespace feebumper {
|
|
|
|
|
|
|
|
enum class Result
|
2017-03-03 12:15:47 -03:00
|
|
|
{
|
|
|
|
OK,
|
|
|
|
INVALID_ADDRESS_OR_KEY,
|
|
|
|
INVALID_REQUEST,
|
|
|
|
INVALID_PARAMETER,
|
|
|
|
WALLET_ERROR,
|
|
|
|
MISC_ERROR,
|
|
|
|
};
|
|
|
|
|
2017-06-15 10:34:17 -04:00
|
|
|
//! Return whether transaction can be bumped.
|
2019-10-10 13:12:28 -03:00
|
|
|
bool TransactionCanBeBumped(const CWallet& wallet, const uint256& txid);
|
2017-06-15 10:34:17 -04:00
|
|
|
|
2019-03-06 18:30:00 -03:00
|
|
|
//! Create bumpfee transaction based on feerate estimates.
|
2019-10-10 13:12:28 -03:00
|
|
|
Result CreateRateBumpTransaction(CWallet& wallet,
|
2020-04-18 15:18:17 -04:00
|
|
|
const uint256& txid,
|
|
|
|
const CCoinControl& coin_control,
|
|
|
|
std::vector<bilingual_str>& errors,
|
|
|
|
CAmount& old_fee,
|
|
|
|
CAmount& new_fee,
|
|
|
|
CMutableTransaction& mtx);
|
2019-03-06 18:30:00 -03:00
|
|
|
|
2017-06-15 10:34:17 -04:00
|
|
|
//! Sign the new transaction,
|
|
|
|
//! @return false if the tx couldn't be found or if it was
|
|
|
|
//! impossible to create the signature(s)
|
2019-10-10 13:12:28 -03:00
|
|
|
bool SignTransaction(CWallet& wallet, CMutableTransaction& mtx);
|
2017-06-15 10:34:17 -04:00
|
|
|
|
|
|
|
//! Commit the bumpfee transaction.
|
|
|
|
//! @return success in case of CWallet::CommitTransaction was successful,
|
|
|
|
//! but sets errors if the tx could not be added to the mempool (will try later)
|
|
|
|
//! or if the old transaction could not be marked as replaced.
|
2019-10-10 13:12:28 -03:00
|
|
|
Result CommitTransaction(CWallet& wallet,
|
2020-04-18 15:18:17 -04:00
|
|
|
const uint256& txid,
|
|
|
|
CMutableTransaction&& mtx,
|
|
|
|
std::vector<bilingual_str>& errors,
|
|
|
|
uint256& bumped_txid);
|
2017-03-03 12:15:47 -03:00
|
|
|
|
2017-09-20 17:19:30 -03:00
|
|
|
} // namespace feebumper
|
|
|
|
|
2017-03-03 12:15:47 -03:00
|
|
|
#endif // BITCOIN_WALLET_FEEBUMPER_H
|