not remove after read

This commit is contained in:
Nguyen Sy Thanh Son 2019-01-03 15:11:59 +00:00
parent 2ce17e99b4
commit 885babf92d
2 changed files with 5 additions and 8 deletions

View file

@ -888,12 +888,12 @@ func (c *Posv) Finalize(chain consensus.ChainReader, header *types.Header, state
}
}
if c.HookReward != nil && number%rCheckpoint == 0 {
if !c.EnableCache && c.BlockSigners.Len() >= 2700 {
fmt.Println("EnableCache true c.BlockSigners.Len()", c.BlockSigners.Len())
c.EnableCache = true
}
if c.HookReward != nil && number%rCheckpoint == 0 {
err, rewards := c.HookReward(chain, state, header)
if err != nil {
return nil, err

View file

@ -210,7 +210,6 @@ func GetSignersFromContract(c *posv.Posv, addrBlockSigner common.Address, client
}
return addrs, nil
} else {
c.BlockSigners.Remove(blockHash)
return caddrs.([]common.Address), nil
}
return nil, nil
@ -357,10 +356,8 @@ func GetRewardForCheckpoint(c *posv.Posv, chain consensus.ChainReader, blockSign
go func(i uint64) {
block := chain.GetHeaderByNumber(i)
addrs, err := GetSignersFromContract(c, blockSignerAddr, client, block.Hash())
// addrs, err := GetSignersFromContract2(c, blockSignerAddr, client, block.Hash())
if err != nil {
log.Crit("Fail to get signers from smartcontract.", "error", err, "blockNumber", i)
// return nil, err
}
squeue <- addrs
}(i)