mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
debug missing receipt
This commit is contained in:
parent
a7d9b52eaf
commit
585fc9455e
2 changed files with 7 additions and 0 deletions
|
|
@ -623,6 +623,9 @@ func WriteReceipts(db ethdb.KeyValueWriter, hash common.Hash, number uint64, rec
|
||||||
|
|
||||||
// WriteRawReceipts stores all the transaction receipts belonging to a block.
|
// WriteRawReceipts stores all the transaction receipts belonging to a block.
|
||||||
func WriteRawReceipts(db ethdb.KeyValueWriter, hash common.Hash, number uint64, receipts rlp.RawValue) {
|
func WriteRawReceipts(db ethdb.KeyValueWriter, hash common.Hash, number uint64, receipts rlp.RawValue) {
|
||||||
|
if len(receipts) == 0 {
|
||||||
|
panic("empty receipts in snap sync block")
|
||||||
|
}
|
||||||
// Store the flattened receipt slice
|
// Store the flattened receipt slice
|
||||||
if err := db.Put(blockReceiptsKey(number, hash), receipts); err != nil {
|
if err := db.Put(blockReceiptsKey(number, hash), receipts); err != nil {
|
||||||
log.Crit("Failed to store block receipts", "err", err)
|
log.Crit("Failed to store block receipts", "err", err)
|
||||||
|
|
|
||||||
|
|
@ -1039,7 +1039,11 @@ func (d *Downloader) commitSnapSyncData(results []*fetchResult, stateSync *state
|
||||||
for i, result := range results {
|
for i, result := range results {
|
||||||
blocks[i] = types.NewBlockWithHeader(result.Header).WithBody(result.body())
|
blocks[i] = types.NewBlockWithHeader(result.Header).WithBody(result.body())
|
||||||
receipts[i] = result.Receipts
|
receipts[i] = result.Receipts
|
||||||
|
if len(result.Receipts) == 0 {
|
||||||
|
panic("empty receipts in snap sync block")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
fmt.Printf(">>>> Committing %d snap-sync blocks, first %d, last %d\n", len(results), first.Number.Uint64(), last.Number.Uint64())
|
||||||
if index, err := d.blockchain.InsertReceiptChain(blocks, receipts, d.ancientLimit); err != nil {
|
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)
|
log.Debug("Downloaded item processing failed", "number", results[index].Header.Number, "hash", results[index].Header.Hash(), "err", err)
|
||||||
return fmt.Errorf("%w: %v", errInvalidChain, err)
|
return fmt.Errorf("%w: %v", errInvalidChain, err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue