@@ -389,14 +389,6 @@ func getVoteAttestationFromHeader(header *types.Header, chainConfig *params.Chai
389
389
return & attestation , nil
390
390
}
391
391
392
- func getSignRecentlyLimit (blockNumber * big.Int , validatorsNumber int , chainConfig * params.ChainConfig ) int {
393
- limit := validatorsNumber / 2 + 1
394
- if chainConfig .IsBoneh (blockNumber ) {
395
- limit = cmath .CeilDiv (validatorsNumber * 2 , 3 )
396
- }
397
- return limit
398
- }
399
-
400
392
// verifyVoteAttestation checks whether the vote attestation in the header is valid.
401
393
func (p * Parlia ) verifyVoteAttestation (chain consensus.ChainHeaderReader , header * types.Header , parents []* types.Header ) error {
402
394
attestation , err := getVoteAttestationFromHeader (header , p .chainConfig , p .config )
@@ -757,7 +749,7 @@ func (p *Parlia) verifySeal(chain consensus.ChainHeaderReader, header *types.Hea
757
749
for seen , recent := range snap .Recents {
758
750
if recent == signer {
759
751
// Signer is among recents, only fail if the current block doesn't shift it out
760
- if limit := getSignRecentlyLimit ( header . Number , len (snap .Validators ), p . chainConfig ); seen > number - uint64 ( limit ) {
752
+ if limit := uint64 ( len (snap .Validators )/ 2 + 1 ); seen > number - limit {
761
753
return errRecentlySigned
762
754
}
763
755
}
@@ -1291,7 +1283,7 @@ func (p *Parlia) Seal(chain consensus.ChainHeaderReader, block *types.Block, res
1291
1283
for seen , recent := range snap .Recents {
1292
1284
if recent == val {
1293
1285
// Signer is among recents, only wait if the current block doesn't shift it out
1294
- if limit := getSignRecentlyLimit ( header . Number , len (snap .Validators ), p . chainConfig ); number < uint64 ( limit ) || seen > number - uint64 ( limit ) {
1286
+ if limit := uint64 ( len (snap .Validators )/ 2 + 1 ); number < limit || seen > number - limit {
1295
1287
log .Info ("Signed recently, must wait for others" )
1296
1288
return nil
1297
1289
}
@@ -1406,8 +1398,7 @@ func (p *Parlia) SignRecently(chain consensus.ChainReader, parent *types.Block)
1406
1398
}
1407
1399
1408
1400
// Signer is among recents, only wait if the current block doesn't shift it out
1409
- limit := getSignRecentlyLimit (parent .Number (), len (snap .Validators ), p .chainConfig )
1410
- if number < uint64 (limit ) || seen > number - uint64 (limit ) {
1401
+ if limit := uint64 (len (snap .Validators )/ 2 + 1 ); number < limit || seen > number - limit {
1411
1402
return true , nil
1412
1403
}
1413
1404
}
@@ -1849,7 +1840,7 @@ func (p *Parlia) backOffTime(snap *Snapshot, header *types.Header, val common.Ad
1849
1840
1850
1841
// Exclude the recently signed validators first, and then compute the backOffTime.
1851
1842
recentVals := make (map [common.Address ]struct {}, len (snap .Recents ))
1852
- limit := getSignRecentlyLimit ( header . Number , len (snap .Validators ), p . chainConfig )
1843
+ limit := len (snap .Validators )/ 2 + 1
1853
1844
for seen , recent := range snap .Recents {
1854
1845
if header .Number .Uint64 () < uint64 (limit ) || seen > header .Number .Uint64 ()- uint64 (limit ) {
1855
1846
if val == recent {
0 commit comments