Use fee/priority estimates in wallet CreateTransaction
The wallet now uses the mempool fee estimator with a new command-line option: -txconfirmtarget (default: 1) instead of using hard-coded fees or priorities. A new bitcoind that hasn't seen enough transactions to estimate will fall back to the old hard-coded minimum priority or transaction fee. -paytxfee option overrides -txconfirmtarget. Relaying and mining code isn't changed. For Qt, the coin control dialog now uses priority estimates to label transaction priority (instead of hard-coded constants); unspent outputs were consistently labeled with a much higher priority than is justified by the free transactions actually being accepted into blocks. I did not implement any GUI for setting -txconfirmtarget; I would suggest getting rid of the "Pay transaction fee" GUI and replace it with either "target number of confirmations" or maybe a "faster confirmation <--> lower fee" slider or select box.
This commit is contained in:
@@ -25,12 +25,15 @@
|
||||
|
||||
// Settings
|
||||
extern CFeeRate payTxFee;
|
||||
extern unsigned int nTxConfirmTarget;
|
||||
extern bool bSpendZeroConfChange;
|
||||
|
||||
// -paytxfee default
|
||||
static const int64_t DEFAULT_TRANSACTION_FEE = 0;
|
||||
// -paytxfee will warn if called with a higher fee than this amount (in satoshis) per KB
|
||||
static const int nHighTransactionFeeWarning = 0.01 * COIN;
|
||||
// Largest (in bytes) free transaction we're willing to create
|
||||
static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000;
|
||||
|
||||
class CAccountingEntry;
|
||||
class CCoinControl;
|
||||
@@ -265,6 +268,8 @@ public:
|
||||
std::string SendMoney(CScript scriptPubKey, int64_t nValue, CWalletTx& wtxNew);
|
||||
std::string SendMoneyToDestination(const CTxDestination &address, int64_t nValue, CWalletTx& wtxNew);
|
||||
|
||||
static int64_t GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool);
|
||||
|
||||
bool NewKeyPool();
|
||||
bool TopUpKeyPool(unsigned int kpSize = 0);
|
||||
void ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool);
|
||||
|
||||
Reference in New Issue
Block a user