From 34e2122e580c698d1ea3f1608d56fd8770f7e157 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 19 Nov 2019 20:37:27 +0300 Subject: [PATCH] core: only check tx against mempool if it's not in the block Fixes failure to process transaction from the block when it was relayed initially: WARN[0788] blockQueue: failed adding block into the blockchain blockHeight=7270 error="transaction 35088916403e5cf2152e16c3bc6e0fba20c955fba38543b9fa5c50a3d3a4ace5 failed to verify: invalid transaction due to conflicts with the memory pool" nextIndex=7271 WARN[0790] blockQueue: failed adding block into the blockchain blockHeight=7270 error="transaction 35088916403e5cf2152e16c3bc6e0fba20c955fba38543b9fa5c50a3d3a4ace5 failed to verify: invalid transaction due to conflicts with the memory pool" nextIndex=7271 WARN[0790] blockQueue: failed adding block into the blockchain blockHeight=7270 error="transaction 35088916403e5cf2152e16c3bc6e0fba20c955fba38543b9fa5c50a3d3a4ace5 failed to verify: invalid transaction due to conflicts with the memory pool" nextIndex=7271 --- pkg/core/blockchain.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index dd861c90e..22bf454a9 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -943,8 +943,10 @@ func (bc *Blockchain) VerifyTx(t *transaction.Transaction, block *Block) error { if ok := bc.verifyInputs(t); !ok { return errors.New("invalid transaction's inputs") } - if ok := bc.memPool.Verify(t); !ok { - return errors.New("invalid transaction due to conflicts with the memory pool") + if block == nil { + if ok := bc.memPool.Verify(t); !ok { + return errors.New("invalid transaction due to conflicts with the memory pool") + } } if IsDoubleSpend(bc.store, t) { return errors.New("invalid transaction caused by double spending")