Skip to content

Commit f58b3c6

Browse files
committed
[reward] remove check new start epoch
1 parent c5a79a0 commit f58b3c6

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

action/protocol/rewarding/protocol.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,7 @@ func (p *Protocol) setFoundationBonusExtension(ctx context.Context, sm protocol.
143143

144144
rp := rolldpos.MustGetProtocol(protocol.MustGetRegistry(ctx))
145145
blkCtx := protocol.MustGetBlockCtx(ctx)
146-
newStartEpoch := rp.GetEpochNum(blkCtx.BlockHeight)
147-
newLastEpoch := newStartEpoch + 8760
148-
149-
if newStartEpoch < p.cfg.FoundationBonusP2StartEpoch {
150-
return errInvalidEpoch
151-
}
146+
newLastEpoch := rp.GetEpochNum(blkCtx.BlockHeight) + 8760
152147

153148
if a.foundationBonusLastEpoch < p.cfg.FoundationBonusP2EndEpoch {
154149
a.foundationBonusLastEpoch = p.cfg.FoundationBonusP2EndEpoch

action/protocol/rewarding/protocol_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,11 +568,10 @@ func TestMigrateValue(t *testing.T) {
568568

569569
for _, v := range []struct {
570570
height, lastEpoch uint64
571-
err error
572571
}{
573-
{g.GreenlandBlockHeight, a1.foundationBonusLastEpoch, nil},
574-
{1641601, a1.foundationBonusLastEpoch, errInvalidEpoch},
575-
{g.KamchatkaBlockHeight, 47796, nil},
572+
{g.GreenlandBlockHeight, a1.foundationBonusLastEpoch},
573+
{1641601, g.FoundationBonusP2EndEpoch},
574+
{g.KamchatkaBlockHeight, 47796},
576575
} {
577576
fCtx := ctx
578577
if v.height == 1641601 {
@@ -585,7 +584,7 @@ func TestMigrateValue(t *testing.T) {
585584
blkCtx := protocol.MustGetBlockCtx(ctx)
586585
blkCtx.BlockHeight = v.height
587586
fCtx = protocol.WithBlockCtx(fCtx, blkCtx)
588-
r.Equal(v.err, p.CreatePreStates(fCtx, sm))
587+
r.NoError(p.CreatePreStates(fCtx, sm))
589588

590589
// verify v1 is deleted
591590
_, err = p.stateV1(sm, adminKey, &a)

0 commit comments

Comments
 (0)