minor fixes

This commit is contained in:
Alfonso de la Rocha 2022-10-03 09:29:42 +02:00
parent 653af01235
commit 95c0afb99b
3 changed files with 4 additions and 6 deletions

View File

@ -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

View File

@ -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()

View File

@ -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)
}