From 95c0afb99b7e926bb447f22f9191847f079e820b Mon Sep 17 00:00:00 2001 From: Alfonso de la Rocha Date: Mon, 3 Oct 2022 09:29:42 +0200 Subject: [PATCH] minor fixes --- chain/consensus/common.go | 1 - chain/consensus/filcns/filecoin.go | 6 +++--- chain/consensus/filcns/mine.go | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/chain/consensus/common.go b/chain/consensus/common.go index 714c2de8d..af78097f8 100644 --- a/chain/consensus/common.go +++ b/chain/consensus/common.go @@ -70,7 +70,6 @@ func RunAsyncChecks(ctx context.Context, await []async.ErrorFuture) error { } // CommonBlkChecks performed by all consensus implementations. -//TODO: Take stateManager and ChainStore in a common object abstracted by all consensus algorithms? func CommonBlkChecks(ctx context.Context, sm *stmgr.StateManager, cs *store.ChainStore, b *types.FullBlock, baseTs *types.TipSet) []async.ErrorFuture { h := b.Header diff --git a/chain/consensus/filcns/filecoin.go b/chain/consensus/filcns/filecoin.go index 99612bd57..543dc5c68 100644 --- a/chain/consensus/filcns/filecoin.go +++ b/chain/consensus/filcns/filecoin.go @@ -223,7 +223,7 @@ func (filec *FilecoinEC) ValidateBlock(ctx context.Context, b *types.FullBlock) }) blockSigCheck := async.Err(func() error { - if err := filec.VerifyBlockSignature(ctx, h, waddr); err != nil { + if err := verifyBlockSignature(ctx, h, waddr); err != nil { return xerrors.Errorf("check block signature failed: %w", err) } return nil @@ -507,12 +507,12 @@ func (filec *FilecoinEC) isChainNearSynced() bool { return build.Clock.Since(timestampTime) < 6*time.Hour } -func (filec *FilecoinEC) VerifyBlockSignature(ctx context.Context, h *types.BlockHeader, +func verifyBlockSignature(ctx context.Context, h *types.BlockHeader, addr address.Address) error { return sigs.CheckBlockSignature(ctx, h, addr) } -func (filec *FilecoinEC) SignBlock(ctx context.Context, w api.Wallet, +func signBlock(ctx context.Context, w api.Wallet, addr address.Address, next *types.BlockHeader) error { nosigbytes, err := next.SigningBytes() diff --git a/chain/consensus/filcns/mine.go b/chain/consensus/filcns/mine.go index 68d4cc88c..d5d605a13 100644 --- a/chain/consensus/filcns/mine.go +++ b/chain/consensus/filcns/mine.go @@ -51,8 +51,7 @@ func (filec *FilecoinEC) CreateBlock(ctx context.Context, w api.Wallet, bt *api. return nil, xerrors.Errorf("failed to process messages from block template: %w", err) } - filec.SignBlock(ctx, w, worker, next) - if err != nil { + if err := signBlock(ctx, w, worker, next); err != nil { return nil, xerrors.Errorf("failed to sign new block: %w", err) }