lotus/api/test/mining.go

32 lines
565 B
Go
Raw Permalink Normal View History

2019-09-23 15:27:30 +00:00
package test
import (
"context"
"testing"
"github.com/stretchr/testify/require"
)
func (ts *testSuite) testMining(t *testing.T) {
ctx := context.Background()
2019-11-30 23:17:50 +00:00
apis, sn := ts.makeNodes(t, 1, []int{0})
2019-09-23 15:27:30 +00:00
api := apis[0]
h1, err := api.ChainHead(ctx)
require.NoError(t, err)
require.Equal(t, uint64(0), h1.Height())
newHeads, err := api.ChainNotify(ctx)
require.NoError(t, err)
<-newHeads
2019-11-30 23:17:50 +00:00
err = sn[0].MineOne(ctx)
2019-09-23 15:27:30 +00:00
require.NoError(t, err)
<-newHeads
h2, err := api.ChainHead(ctx)
require.NoError(t, err)
require.Equal(t, uint64(1), h2.Height())
}