From 8a3508441a0ac15a2844a5dd60356e15fbfdbaa0 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 31 Oct 2023 10:23:09 +0100 Subject: [PATCH] core: check receipt block number/hash in test --- core/chain_makers_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/chain_makers_test.go b/core/chain_makers_test.go index 5e1f0edbb3..610412b2df 100644 --- a/core/chain_makers_test.go +++ b/core/chain_makers_test.go @@ -145,8 +145,16 @@ func TestGeneratePOSChain(t *testing.T) { // Verify receipts. genBlockReceipts := genreceipts[i] for _, r := range genBlockReceipts { + if r.BlockNumber.Cmp(block.Number()) != 0 { + t.Errorf("receipt has wrong block number %d, want %d", r.BlockNumber, block.Number()) + } + if r.BlockHash != block.Hash() { + t.Errorf("receipt has wrong block hash %v, want %v", r.BlockNumber, block.Hash()) + } + + // patch up empty logs list to make DeepEqual below work if r.Logs == nil { - r.Logs = []*types.Log{} // patch up empty logs to match decoded from db + r.Logs = []*types.Log{} } } blockchainReceipts := blockchain.GetReceiptsByHash(block.Hash())