Update graphql.go

Add nil check before calling tx.Type() to prevent panic when transaction
is not found. This matches the defensive pattern used in other Transaction
resolver methods.
This commit is contained in:
oooLowNeoNooo 2025-11-14 08:03:41 +01:00 committed by GitHub
parent 488d987fc4
commit 67fa6df901
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -575,6 +575,9 @@ func (t *Transaction) getLogs(ctx context.Context, hash common.Hash) (*[]*Log, e
func (t *Transaction) Type(ctx context.Context) *hexutil.Uint64 { func (t *Transaction) Type(ctx context.Context) *hexutil.Uint64 {
tx, _ := t.resolve(ctx) tx, _ := t.resolve(ctx)
if tx == nil {
return nil
}
txType := hexutil.Uint64(tx.Type()) txType := hexutil.Uint64(tx.Type())
return &txType return &txType
} }