diff --git a/mempool/mempool.go b/mempool/mempool.go index d3f8b75b..f70d6447 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -30,10 +30,6 @@ const ( // inclusion when generating block templates. DefaultBlockPrioritySize = 50000 - // MinHighPriority is the minimum priority value that allows a - // transaction to be considered high priority. - MinHighPriority = btcutil.SatoshiPerBitcoin * 144.0 / 250 - // orphanTTL is the maximum amount of time an orphan is allowed to // stay in the orphan pool before it expires and is evicted during the // next scan. @@ -797,10 +793,10 @@ func (mp *TxPool) maybeAcceptTransaction(tx *btcutil.Tx, isNew, rateLimit, rejec if isNew && !mp.cfg.Policy.DisableRelayPriority && txFee < minFee { currentPriority := mining.CalcPriority(tx.MsgTx(), utxoView, nextBlockHeight) - if currentPriority <= MinHighPriority { + if currentPriority <= mining.MinHighPriority { str := fmt.Sprintf("transaction %v has insufficient "+ "priority (%g <= %g)", txHash, - currentPriority, MinHighPriority) + currentPriority, mining.MinHighPriority) return nil, txRuleError(wire.RejectInsufficientFee, str) } } diff --git a/mining.go b/mining.go index b11fa2a1..f253610d 100644 --- a/mining.go +++ b/mining.go @@ -12,7 +12,6 @@ import ( "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/btcsuite/btcd/mempool" "github.com/btcsuite/btcd/mining" "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" @@ -638,13 +637,13 @@ mempoolLoop: // the priority size or there are no more high-priority // transactions. if !sortedByFee && (blockPlusTxSize >= policy.BlockPrioritySize || - prioItem.priority <= mempool.MinHighPriority) { + prioItem.priority <= mining.MinHighPriority) { minrLog.Tracef("Switching to sort by fees per "+ "kilobyte blockSize %d >= BlockPrioritySize "+ "%d || priority %.2f <= minHighPriority %.2f", blockPlusTxSize, policy.BlockPrioritySize, - prioItem.priority, mempool.MinHighPriority) + prioItem.priority, mining.MinHighPriority) sortedByFee = true priorityQueue.SetLessFunc(txPQByFee) @@ -656,7 +655,7 @@ mempoolLoop: // final one in the high-priority section, so just fall // though to the code below so it is added now. if blockPlusTxSize > policy.BlockPrioritySize || - prioItem.priority < mempool.MinHighPriority { + prioItem.priority < mining.MinHighPriority { heap.Push(priorityQueue, prioItem) continue diff --git a/mining/mining.go b/mining/mining.go index cf6f14ba..87c50598 100644 --- a/mining/mining.go +++ b/mining/mining.go @@ -11,6 +11,12 @@ import ( "github.com/btcsuite/btcutil" ) +const ( + // MinHighPriority is the minimum priority value that allows a + // transaction to be considered high priority. + MinHighPriority = btcutil.SatoshiPerBitcoin * 144.0 / 250 +) + // TxDesc is a descriptor about a transaction in a transaction source along with // additional metadata. type TxDesc struct {