Skip to content

Commit

Permalink
add tx protected check at eth_sendRawTranasaction api
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Jan 15, 2025
1 parent 0ac1947 commit ab19d9d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jsonrpc/backend/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ func (b *JSONRPCBackend) SendRawTransaction(input hexutil.Bytes) (common.Hash, e
return common.Hash{}, err
}

if !tx.Protected() {
// Ensure only eip155 signed transactions are submitted if EIP155Required is set.
return common.Hash{}, errors.New("only replay-protected (EIP-155) transactions allowed over RPC")
}

Check warning on line 35 in jsonrpc/backend/tx.go

View check run for this annotation

Codecov / codecov/patch

jsonrpc/backend/tx.go#L33-L35

Added lines #L33 - L35 were not covered by tests

if err := b.SendTx(tx); err != nil {
return common.Hash{}, err
}
Expand Down

0 comments on commit ab19d9d

Please sign in to comment.