fix signature for NewTestMiner
This commit is contained in:
parent
f529f3b14d
commit
887bf0511f
@ -54,7 +54,7 @@ type LotusNode struct {
|
|||||||
FullApi api.FullNode
|
FullApi api.FullNode
|
||||||
MinerApi api.StorageMiner
|
MinerApi api.StorageMiner
|
||||||
StopFn node.StopFunc
|
StopFn node.StopFunc
|
||||||
MineOne func(context.Context, func(bool)) error
|
MineOne func(context.Context, func(bool, error)) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *LotusNode) setWallet(ctx context.Context, walletKey *wallet.Key) error {
|
func (n *LotusNode) setWallet(ctx context.Context, walletKey *wallet.Key) error {
|
||||||
|
@ -197,10 +197,10 @@ func PrepareMiner(t *TestEnvironment) (*LotusMiner, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if t.StringParam("mining_mode") != "natural" {
|
if t.StringParam("mining_mode") != "natural" {
|
||||||
mineBlock := make(chan func(bool))
|
mineBlock := make(chan func(bool, error))
|
||||||
minerOpts = append(minerOpts,
|
minerOpts = append(minerOpts,
|
||||||
node.Override(new(*miner.Miner), miner.NewTestMiner(mineBlock, minerAddr)))
|
node.Override(new(*miner.Miner), miner.NewTestMiner(mineBlock, minerAddr)))
|
||||||
n.MineOne = func(ctx context.Context, cb func(bool)) error {
|
n.MineOne = func(ctx context.Context, cb func(bool, error)) error {
|
||||||
select {
|
select {
|
||||||
case mineBlock <- cb:
|
case mineBlock <- cb:
|
||||||
return nil
|
return nil
|
||||||
@ -352,7 +352,11 @@ func (m *LotusMiner) RunDefault() error {
|
|||||||
t.SyncClient.MustSignalAndWait(ctx, stateMineNext, miners)
|
t.SyncClient.MustSignalAndWait(ctx, stateMineNext, miners)
|
||||||
|
|
||||||
ch := make(chan struct{})
|
ch := make(chan struct{})
|
||||||
err := m.MineOne(ctx, func(mined bool) {
|
err := m.MineOne(ctx, func(mined bool, err error) {
|
||||||
|
if err != nil {
|
||||||
|
t.D().Counter("block.mine.err").Inc(1)
|
||||||
|
return
|
||||||
|
}
|
||||||
if mined {
|
if mined {
|
||||||
t.D().Counter(fmt.Sprintf("block.mine,miner=%s", myActorAddr)).Inc(1)
|
t.D().Counter(fmt.Sprintf("block.mine,miner=%s", myActorAddr)).Inc(1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user