mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 22:26:42 +00:00
eth/downloader: different fix
This commit is contained in:
parent
2bad9dbca9
commit
d8bed16fa7
2 changed files with 7 additions and 9 deletions
|
|
@ -1039,13 +1039,6 @@ func (d *Downloader) commitSnapSyncData(results []*fetchResult, stateSync *state
|
|||
for i, result := range results {
|
||||
blocks[i] = types.NewBlockWithHeader(result.Header).WithBody(result.body())
|
||||
receipts[i] = result.Receipts
|
||||
// Blockchain expects the receipts to be properly encoded
|
||||
// as they are inserted into the db as they are.
|
||||
// This workaround makes sure that blocks with no receipts
|
||||
// have a valid encoding.
|
||||
if len(result.Receipts) == 0 {
|
||||
receipts[i] = rlp.EmptyList
|
||||
}
|
||||
}
|
||||
if index, err := d.blockchain.InsertReceiptChain(blocks, receipts, d.ancientLimit); err != nil {
|
||||
log.Debug("Downloaded item processing failed", "number", results[index].Header.Number, "hash", results[index].Header.Hash(), "err", err)
|
||||
|
|
|
|||
|
|
@ -83,8 +83,13 @@ func newFetchResult(header *types.Header, snapSync bool) *fetchResult {
|
|||
} else if header.WithdrawalsHash != nil {
|
||||
item.Withdrawals = make(types.Withdrawals, 0)
|
||||
}
|
||||
if snapSync && !header.EmptyReceipts() {
|
||||
item.pending.Store(item.pending.Load() | (1 << receiptType))
|
||||
if snapSync {
|
||||
if header.EmptyReceipts() {
|
||||
// Ensure the receipts list is valid even if it isn't actively fetched.
|
||||
item.Receipts = rlp.EmptyList
|
||||
} else {
|
||||
item.pending.Store(item.pending.Load() | (1 << receiptType))
|
||||
}
|
||||
}
|
||||
return item
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue