From 09f4176a8a15a1dafd85a77213036feebf617471 Mon Sep 17 00:00:00 2001 From: laizy Date: Wed, 4 Jul 2018 13:56:12 +0800 Subject: [PATCH] fix race condition in txpool --- net/node/transactionPool.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/node/transactionPool.go b/net/node/transactionPool.go index 01800b5c..d3a141ba 100644 --- a/net/node/transactionPool.go +++ b/net/node/transactionPool.go @@ -215,9 +215,11 @@ func (this *TXNPool) cleanTransactionList(txns []*transaction.Transaction) error cleaned++ } else { log.Infof("txn=%x not cleaned", txn.Hash()) + this.Lock() for _, v := range this.txnList { log.Infof("v.Hash()=%x", v.Hash()) } + this.Unlock() } } if txnsNum != cleaned {