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
This commit is contained in:
parent
27a57e1a2d
commit
34e2122e58
1 changed files with 4 additions and 2 deletions
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue