Skip to content

Commit

Permalink
fix(protocol): timestamp verification is wrong (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyPansier authored Nov 25, 2022
1 parent 1e8f676 commit 517ad58
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node/protocol/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 517ad58

Please sign in to comment.