Skip to content

Commit

Permalink
validate 2 blocks before commit first
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinxie committed Jan 23, 2025
1 parent e02f31a commit b17128e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion blockchain/integrity/integrity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ func TestBlockPipeline(t *testing.T) {
require.NoError(err)
require.EqualValues(1, blk.Height())
require.Equal(4, len(blk.Body.Actions))
require.NoError(bc.CommitBlock(blk))
require.NoError(bc.ValidateBlock(blk))
// add block 2
tsf3, err := action.SignedTransfer(identityset.Address(23).String(), priKey0, 4, big.NewInt(30000), nil, 500000, minGas)
require.NoError(err)
Expand All @@ -1057,10 +1057,13 @@ func TestBlockPipeline(t *testing.T) {
tsf4, err := action.SignedTransfer(deterministic.String(), priKey0, 5, big.NewInt(10000000000000000), nil, 500000, minGas)
require.NoError(err)
require.NoError(ap.Add(ctx, tsf4))
println("mint block 2")
blk1, err := bc.MintNewBlock(blockTime.Add(time.Second))
require.NoError(err)
require.EqualValues(2, blk1.Height())
require.Equal(3, len(blk1.Body.Actions))
require.NoError(bc.ValidateBlock(blk1))
require.NoError(bc.CommitBlock(blk))
require.NoError(bc.CommitBlock(blk1))
// verify accounts
for _, v := range []struct {
Expand Down
2 changes: 2 additions & 0 deletions state/factory/workingset.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package factory

import (
"context"
"fmt"
"math/big"
"sort"
"sync/atomic"
Expand Down Expand Up @@ -221,6 +222,7 @@ func (ws *workingSet) runAction(
return nil, err
}
}
fmt.Printf("action %x added to block\n", selpHash)
return receipt, nil
}
}
Expand Down

0 comments on commit b17128e

Please sign in to comment.