db receipt lacks txs

This commit is contained in:
Nguyen Sy Thanh Son 2019-01-14 12:09:20 +00:00
parent 4409c4c02f
commit 584d60c63f
2 changed files with 4 additions and 4 deletions

View file

@ -307,7 +307,7 @@ func DecryptRandomizeFromSecretsAndOpening(secrets [][32]byte, opening [32]byte)
}
// Calculate reward for reward checkpoint.
func GetRewardForCheckpoint(c *posv.Posv, chain consensus.ChainReader, number uint64, rCheckpoint uint64, totalSigner *uint64) (map[common.Address]*rewardLog, error) {
func GetRewardForCheckpoint(chainDb ethdb.Database, c *posv.Posv, chain consensus.ChainReader, number uint64, rCheckpoint uint64, totalSigner *uint64) (map[common.Address]*rewardLog, error) {
// Not reward for singer of genesis block and only calculate reward at checkpoint block.
prevCheckpoint := number - (rCheckpoint * 2)
startBlockNumber := prevCheckpoint + 1
@ -332,12 +332,12 @@ func GetRewardForCheckpoint(c *posv.Posv, chain consensus.ChainReader, number ui
log.Debug("Failed get from cached", "hash", header.Hash().String(), "number", i)
block := chain.GetBlock(header.Hash(), i)
txs := block.Transactions()
receipts := core.GetBlockReceipts(c.GetDb(), header.Hash(), i)
receipts := core.GetBlockReceipts(chainDb, header.Hash(), i)
var signTxs []*types.Transaction
for _, tx := range txs {
if tx.IsSigningTransaction() {
var b uint
b := types.ReceiptStatusSuccessful
for _, r := range receipts {
if r.TxHash == tx.Hash() {
b = r.Status

View file

@ -312,7 +312,7 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
chainReward = rewardInflation(chainReward, number, common.BlocksPerYear)
totalSigner := new(uint64)
signers, err := contracts.GetRewardForCheckpoint(c, chain, number, rCheckpoint, totalSigner)
signers, err := contracts.GetRewardForCheckpoint(eth.chainDb, c, chain, number, rCheckpoint, totalSigner)
log.Debug("Time Get Signers", "block", header.Number.Uint64(), "time", common.PrettyDuration(time.Since(start)))
if err != nil {