Skip to content

Commit

Permalink
chain: Benchmark chain gen
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Jul 26, 2019
1 parent bace5ea commit 9be45a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 9 additions & 2 deletions chain/gen/gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"testing"
)

func TestChainGeneration(t *testing.T) {
func testGeneration(t testing.TB, n int) {
g, err := NewGenerator()
if err != nil {
t.Fatal(err)
}

for i := 0; i < 10; i++ {
for i := 0; i < n; i++ {
b, err := g.NextBlock()
if err != nil {
t.Fatalf("error at H:%d, %s", i, err)
Expand All @@ -19,5 +19,12 @@ func TestChainGeneration(t *testing.T) {
t.Fatal("wrong height")
}
}
}

func TestChainGeneration(t *testing.T) {
testGeneration(t, 10)
}

func BenchmarkChainGeneration(b *testing.B) {
testGeneration(b, b.N)
}
4 changes: 1 addition & 3 deletions chain/gen/mining.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ package gen

import (
"context"
"fmt"

bls "github.com/filecoin-project/go-bls-sigs"
cid "github.com/ipfs/go-cid"
hamt "github.com/ipfs/go-hamt-ipld"
"github.com/pkg/errors"
sharray "github.com/whyrusleeping/sharray"
bls "github.com/filecoin-project/go-bls-sigs"

"github.com/filecoin-project/go-lotus/chain/actors"
"github.com/filecoin-project/go-lotus/chain/address"
Expand Down Expand Up @@ -42,7 +41,6 @@ func MinerCreateBlock(cs *store.ChainStore, miner address.Address, parents *type
Height: height,
}

fmt.Printf("adding %d messages to block...\n", len(msgs))
var msgCids []cid.Cid
var blsSigs []types.Signature
var receipts []interface{}
Expand Down

0 comments on commit 9be45a3

Please sign in to comment.