diff --git a/src/node/protocol/blockchain.go b/src/node/protocol/blockchain.go index 12fe7d7b..f86a41ca 100644 --- a/src/node/protocol/blockchain.go +++ b/src/node/protocol/blockchain.go @@ -200,7 +200,7 @@ func (blockchain *Blockchain) getValidBlocks(neighborBlocks []*neighborhood.Bloc if currentBlockTimestamp+blockchain.validationTimer.Nanoseconds() < transaction.Timestamp() { return nil, fmt.Errorf("a neighbor block transaction timestamp is too far in the future, transaction: %v", transaction) } - if transaction.Timestamp() < neighborBlocks[len(neighborBlocks)-2].Timestamp { + if i > 1 && transaction.Timestamp() < neighborBlocks[i-1].Timestamp { return nil, fmt.Errorf("a neighbor block transaction timestamp is too old, transaction: %v", transaction) } }