diff --git a/mempool/mempool.go b/mempool/mempool.go index 8a528626..9e8f9b63 100644 --- a/mempool/mempool.go +++ b/mempool/mempool.go @@ -619,10 +619,11 @@ func (mp *TxPool) maybeAcceptTransaction(tx *btcutil.Tx, isNew, rateLimit, rejec bestHeight := mp.cfg.BestHeight() nextBlockHeight := bestHeight + 1 + medianTimePast := mp.cfg.MedianTimePast() + // Don't allow non-standard transactions if the network parameters // forbid their acceptance. if !mp.cfg.Policy.AcceptNonStd { - medianTimePast := mp.cfg.MedianTimePast() err = checkTransactionStandard(tx, nextBlockHeight, medianTimePast, mp.cfg.Policy.MinRelayTxFee) if err != nil { @@ -692,6 +693,22 @@ func (mp *TxPool) maybeAcceptTransaction(tx *btcutil.Tx, isNew, rateLimit, rejec return missingParents, nil } + // Don't allow the transaction into the mempool unless its sequence + // lock is active, meaning that it'll be allowed into the next block + // with respect to its defined relative lock times. + sequenceLock, err := mp.cfg.CalcSequenceLock(tx, utxoView) + if err != nil { + if cerr, ok := err.(blockchain.RuleError); ok { + return nil, chainRuleError(cerr) + } + return nil, err + } + if !blockchain.SequenceLockActive(sequenceLock, nextBlockHeight, + medianTimePast) { + return nil, txRuleError(wire.RejectNonstandard, + "transaction's sequence locks on inputs not met") + } + // Perform several checks on the transaction inputs using the invariant // rules in blockchain for what transactions are allowed into blocks. // Also returns the fees associated with the transaction which will be diff --git a/mining.go b/mining.go index 63c2b80a..39ba6291 100644 --- a/mining.go +++ b/mining.go @@ -481,7 +481,6 @@ mempoolLoop: } if !blockchain.IsFinalizedTransaction(tx, nextBlockHeight, timeSource.AdjustedTime()) { - minrLog.Tracef("Skipping non-finalized tx %s", tx.Hash()) continue }