From d777eed431936239d3b97177201b135bdd05aeaf Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi Date: Fri, 23 May 2025 15:45:16 +0200 Subject: [PATCH] update tests --- core/rawdb/accessors_chain_test.go | 39 +++++++++++++++++------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/core/rawdb/accessors_chain_test.go b/core/rawdb/accessors_chain_test.go index d98fc9a1eb..684de7d595 100644 --- a/core/rawdb/accessors_chain_test.go +++ b/core/rawdb/accessors_chain_test.go @@ -680,26 +680,28 @@ func makeTestReceipts(n int, nPerBlock int) []types.Receipts { } type fullLogRLP struct { - Address common.Address - Topics []common.Hash - Data []byte - BlockNumber uint64 - TxHash common.Hash - TxIndex uint - BlockHash common.Hash - Index uint + Address common.Address + Topics []common.Hash + Data []byte + BlockNumber uint64 + BlockTimestamp uint64 + TxHash common.Hash + TxIndex uint + BlockHash common.Hash + Index uint } func newFullLogRLP(l *types.Log) *fullLogRLP { return &fullLogRLP{ - Address: l.Address, - Topics: l.Topics, - Data: l.Data, - BlockNumber: l.BlockNumber, - TxHash: l.TxHash, - TxIndex: l.TxIndex, - BlockHash: l.BlockHash, - Index: l.Index, + Address: l.Address, + Topics: l.Topics, + Data: l.Data, + BlockNumber: l.BlockNumber, + BlockTimestamp: l.BlockTimestamp, + TxHash: l.TxHash, + TxIndex: l.TxIndex, + BlockHash: l.BlockHash, + Index: l.Index, } } @@ -834,7 +836,7 @@ func TestDeriveLogFields(t *testing.T) { // Derive log metadata fields number := big.NewInt(1) hash := common.BytesToHash([]byte{0x03, 0x14}) - types.Receipts(receipts).DeriveFields(params.TestChainConfig, hash, number.Uint64(), 0, big.NewInt(0), big.NewInt(0), txs) + types.Receipts(receipts).DeriveFields(params.TestChainConfig, hash, number.Uint64(), 12, big.NewInt(0), big.NewInt(0), txs) // Iterate over all the computed fields and check that they're correct logIndex := uint(0) @@ -846,6 +848,9 @@ func TestDeriveLogFields(t *testing.T) { if receipts[i].Logs[j].BlockHash != hash { t.Errorf("receipts[%d].Logs[%d].BlockHash = %s, want %s", i, j, receipts[i].Logs[j].BlockHash.String(), hash.String()) } + if receipts[i].Logs[j].BlockTimestamp != 12 { + t.Errorf("receipts[%d].Logs[%d].BlockTimestamp = %d, want %d", i, j, receipts[i].Logs[j].BlockTimestamp, 12) + } if receipts[i].Logs[j].TxHash != txs[i].Hash() { t.Errorf("receipts[%d].Logs[%d].TxHash = %s, want %s", i, j, receipts[i].Logs[j].TxHash.String(), txs[i].Hash().String()) }