Skip to content

Commit 77f20c4

Browse files
committed
Add null check to Transaction.MarshalBinary()
1 parent 6ffdec3 commit 77f20c4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

core/types/transaction.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ func (tx *Transaction) encodeTyped(w *bytes.Buffer) error {
184184
// For legacy transactions, it returns the RLP encoding. For EIP-2718 typed
185185
// transactions, it returns the type and payload.
186186
func (tx *Transaction) MarshalBinary() ([]byte, error) {
187+
if tx.inner == nil {
188+
return nil, fmt.Errorf("tx inner data is nil")
189+
}
187190
if tx.Type() == LegacyTxType {
188191
return rlp.EncodeToBytes(tx.inner)
189192
}

0 commit comments

Comments
 (0)