update tests

This commit is contained in:
Sina Mahmoodi 2025-05-23 15:45:16 +02:00
parent 3bcadb7db7
commit d777eed431

View file

@ -684,6 +684,7 @@ type fullLogRLP struct {
Topics []common.Hash
Data []byte
BlockNumber uint64
BlockTimestamp uint64
TxHash common.Hash
TxIndex uint
BlockHash common.Hash
@ -696,6 +697,7 @@ func newFullLogRLP(l *types.Log) *fullLogRLP {
Topics: l.Topics,
Data: l.Data,
BlockNumber: l.BlockNumber,
BlockTimestamp: l.BlockTimestamp,
TxHash: l.TxHash,
TxIndex: l.TxIndex,
BlockHash: l.BlockHash,
@ -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())
}