Skip to content

Commit

Permalink
fix(swamp): simplify and correct FillBlocks and increase amount of pr…
Browse files Browse the repository at this point in the history
…eallocated accounts

FillBlocks was generating much more blocks than expected. Calling of testnode.FillBlock once with block amount of accounts fixes it.
Also, the amoung of preallocated accounts was increased, to ensure enough blocks can be generated
  • Loading branch information
Wondertan committed Oct 6, 2022
1 parent d66fd8c commit dc618fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion nodebuilder/tests/swamp/swamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func NewSwamp(t *testing.T, options ...Option) *Swamp {
ctx := context.Background()

// we create an arbitray number of funded accounts
accounts := make([]string, 10)
accounts := make([]string, 100)
for i := 0; i < 10; i++ {
accounts = append(accounts, tmrand.Str(9))
}
Expand Down
17 changes: 5 additions & 12 deletions nodebuilder/tests/swamp/swamp_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/tendermint/tendermint/pkg/consts"

"github.com/celestiaorg/celestia-app/testutil/testnode"

"github.com/celestiaorg/celestia-app/x/payment"
paytypes "github.com/celestiaorg/celestia-app/x/payment/types"
)
Expand All @@ -26,19 +27,11 @@ func (s *Swamp) SubmitData(ctx context.Context, data []byte) error {
return nil
}

func (s *Swamp) FillBlocks(ctx context.Context, bsize, blocks int) error {
func (s *Swamp) FillBlocks(_ context.Context, bsize, blocks int) error {
btime := s.comps.CoreCfg.Consensus.CreateEmptyBlocksInterval
timer := time.NewTimer(btime)
defer timer.Stop()
for i := 0; i < blocks; i++ {
_, err := testnode.FillBlock(s.ClientContext, bsize, s.accounts)
if err != nil {
return err
}
err = testnode.WaitForNextBlock(s.ClientContext)
if err != nil {
return err
}
}
return nil

_, err := testnode.FillBlock(s.ClientContext, bsize, s.accounts[:blocks+1])
return err
}

0 comments on commit dc618fc

Please sign in to comment.