Skip to content

Commit

Permalink
Merge pull request #11284 from vegaprotocol/pow-fix
Browse files Browse the repository at this point in the history
fix: do not account for started block in the past block range
  • Loading branch information
jeremyletang committed May 17, 2024
1 parent 139e1ac commit daeb04f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/pow/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (e *Engine) updatePowState(txs []abci.Tx) {
}

for i, p := range e.activeParams {
outOfScopeBlock := int64(e.currentBlock) + 1 - int64(p.spamPoWNumberOfPastBlocks)
outOfScopeBlock := int64(e.currentBlock) - int64(p.spamPoWNumberOfPastBlocks)
if outOfScopeBlock < 0 {
continue
}
Expand Down
2 changes: 1 addition & 1 deletion core/pow/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func TestDeliverTxDuplciateNonce(t *testing.T) {
require.Equal(t, 2, len(e.heightToNonceRef[100]))

// check the maps are purged when we leave scope
e.BeginBlock(104, crypto.RandomHash(), []abci.Tx{})
e.BeginBlock(105, crypto.RandomHash(), []abci.Tx{})
require.Equal(t, 0, len(e.seenTid))
require.Equal(t, 0, len(e.heightToTid))
require.Equal(t, 0, len(e.heightToNonceRef))
Expand Down

0 comments on commit daeb04f

Please sign in to comment.