minor fixes
This commit is contained in:
parent
653af01235
commit
95c0afb99b
@ -70,7 +70,6 @@ func RunAsyncChecks(ctx context.Context, await []async.ErrorFuture) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CommonBlkChecks performed by all consensus implementations.
|
// 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,
|
func CommonBlkChecks(ctx context.Context, sm *stmgr.StateManager, cs *store.ChainStore,
|
||||||
b *types.FullBlock, baseTs *types.TipSet) []async.ErrorFuture {
|
b *types.FullBlock, baseTs *types.TipSet) []async.ErrorFuture {
|
||||||
h := b.Header
|
h := b.Header
|
||||||
|
@ -223,7 +223,7 @@ func (filec *FilecoinEC) ValidateBlock(ctx context.Context, b *types.FullBlock)
|
|||||||
})
|
})
|
||||||
|
|
||||||
blockSigCheck := async.Err(func() error {
|
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 xerrors.Errorf("check block signature failed: %w", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -507,12 +507,12 @@ func (filec *FilecoinEC) isChainNearSynced() bool {
|
|||||||
return build.Clock.Since(timestampTime) < 6*time.Hour
|
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 {
|
addr address.Address) error {
|
||||||
return sigs.CheckBlockSignature(ctx, h, addr)
|
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 {
|
addr address.Address, next *types.BlockHeader) error {
|
||||||
|
|
||||||
nosigbytes, err := next.SigningBytes()
|
nosigbytes, err := next.SigningBytes()
|
||||||
|
@ -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)
|
return nil, xerrors.Errorf("failed to process messages from block template: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
filec.SignBlock(ctx, w, worker, next)
|
if err := signBlock(ctx, w, worker, next); err != nil {
|
||||||
if err != nil {
|
|
||||||
return nil, xerrors.Errorf("failed to sign new block: %w", err)
|
return nil, xerrors.Errorf("failed to sign new block: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user