From 527a08eb14cf3028f89eeb81a53df01a4f12b1d2 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Fri, 15 Nov 2013 11:59:32 -0600 Subject: [PATCH] Convert chain RuleError to TxRuleError in mempool. When a transaction is being checked for acceptance into the transation memory pool, it makes use of a chain function to ensure the invariant rules for what transactions are allowed into a block are not violated. That function returns a btcchain.RuleError if rules are violated. However, since this code path is tailored to free-standing transactions, the error needs to be converted to a TxRuleError so the caller can properly detect the transaction as a rejected transaction instead of treating it like an real error. --- mempool.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mempool.go b/mempool.go index 3acbdeec..fac768ad 100644 --- a/mempool.go +++ b/mempool.go @@ -779,6 +779,9 @@ func (mp *txMemPool) maybeAcceptTransaction(tx *btcutil.Tx, isOrphan *bool) erro // used later. txFee, err := btcchain.CheckTransactionInputs(tx, nextBlockHeight, txStore) if err != nil { + if _, ok := err.(btcchain.RuleError); ok { + return TxRuleError(err.Error()) + } return err }