From 0594a622940cfd0a118a04485c6e489b6b9766f6 Mon Sep 17 00:00:00 2001 From: Dustin Xie Date: Sun, 9 Apr 2023 18:25:46 -0700 Subject: [PATCH] special handling for genesis block not needed --- state/factory/workingset.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/state/factory/workingset.go b/state/factory/workingset.go index 273103e6a8..4ef6ad264a 100644 --- a/state/factory/workingset.go +++ b/state/factory/workingset.go @@ -333,15 +333,10 @@ func (ws *workingSet) validateNonce(ctx context.Context, blk *block.Block) error } appendActionIndex(accountNonceMap, caller.String(), selp.Nonce()) } - - // Special handling for genesis block - if blk.Height() == 0 { - return nil - } return ws.checkNonceContinuity(ctx, accountNonceMap) } -func (ws *workingSet) validateNonce2(ctx context.Context, blk *block.Block) error { +func (ws *workingSet) validateNonceSkipSystemAction(ctx context.Context, blk *block.Block) error { accountNonceMap := make(map[string][]uint64) for _, selp := range blk.Actions { if action.IsSystemAction(selp) { @@ -358,11 +353,6 @@ func (ws *workingSet) validateNonce2(ctx context.Context, blk *block.Block) erro } accountNonceMap[srcAddr] = append(accountNonceMap[srcAddr], selp.Nonce()) } - - // Special handling for genesis block - if blk.Height() == 0 { - return nil - } return ws.checkNonceContinuity(ctx, accountNonceMap) } @@ -546,7 +536,7 @@ func updateReceiptIndex(receipts []*action.Receipt) { func (ws *workingSet) ValidateBlock(ctx context.Context, blk *block.Block) error { if protocol.MustGetFeatureCtx(ctx).SkipSystemActionNonce { - if err := ws.validateNonce2(ctx, blk); err != nil { + if err := ws.validateNonceSkipSystemAction(ctx, blk); err != nil { return errors.Wrap(err, "failed to validate nonce") } } else {