From 4e36b1e3dadda62a53e309a1b6cf7aed97ea7a3a Mon Sep 17 00:00:00 2001 From: bas-vk Date: Sat, 10 Dec 2016 23:54:58 +0100 Subject: core: bugfix state change race condition in txpool (#3412) The transaction pool keeps track of the current nonce in its local pendingState. When a new block comes in the pendingState is reset. During the reset it fetches multiple times the current state through the use of the currentState callback. When a second block comes in during the reset its possible that the state changes during the reset. If that block holds transactions that are currently in the pool the local pendingState that is used to determine nonces can get out of sync. --- eth/protocol.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'eth/protocol.go') diff --git a/eth/protocol.go b/eth/protocol.go index 3f65c204b..7d22b33de 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -98,11 +98,11 @@ var errorToString = map[int]string{ type txPool interface { // AddBatch should add the given transactions to the pool. - AddBatch([]*types.Transaction) + AddBatch([]*types.Transaction) error // Pending should return pending transactions. // The slice should be modifiable by the caller. - Pending() map[common.Address]types.Transactions + Pending() (map[common.Address]types.Transactions, error) } // statusData is the network packet for the status message. -- cgit v1.2.3