mirror of
https://github.com/status-im/op-geth.git
synced 2025-02-14 15:56:44 +00:00
ethapi: Omit isSystemTx: "false" from JSON-RPC responses (#60)
This commit is contained in:
parent
13e42b01a4
commit
b9bbfdf372
@ -1464,7 +1464,10 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
|
|||||||
srcHash := tx.SourceHash()
|
srcHash := tx.SourceHash()
|
||||||
isSystemTx := tx.IsSystemTx()
|
isSystemTx := tx.IsSystemTx()
|
||||||
result.SourceHash = &srcHash
|
result.SourceHash = &srcHash
|
||||||
result.IsSystemTx = &isSystemTx
|
if isSystemTx {
|
||||||
|
// Only include IsSystemTx when true
|
||||||
|
result.IsSystemTx = &isSystemTx
|
||||||
|
}
|
||||||
result.Mint = (*hexutil.Big)(tx.Mint())
|
result.Mint = (*hexutil.Big)(tx.Mint())
|
||||||
if receipt != nil && receipt.DepositNonce != nil {
|
if receipt != nil && receipt.DepositNonce != nil {
|
||||||
result.Nonce = hexutil.Uint64(*receipt.DepositNonce)
|
result.Nonce = hexutil.Uint64(*receipt.DepositNonce)
|
||||||
|
@ -36,6 +36,15 @@ func TestNewRPCTransactionDepositTx(t *testing.T) {
|
|||||||
require.Equal(t, got.Nonce, (hexutil.Uint64)(nonce), "newRPCTransaction().Mint = %v, want %v", got.Nonce, nonce)
|
require.Equal(t, got.Nonce, (hexutil.Uint64)(nonce), "newRPCTransaction().Mint = %v, want %v", got.Nonce, nonce)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNewRPCTransactionOmitIsSystemTxFalse(t *testing.T) {
|
||||||
|
tx := types.NewTx(&types.DepositTx{
|
||||||
|
IsSystemTransaction: false,
|
||||||
|
})
|
||||||
|
got := newRPCTransaction(tx, common.Hash{}, uint64(12), uint64(1), big.NewInt(0), ¶ms.ChainConfig{}, nil)
|
||||||
|
|
||||||
|
require.Nil(t, got.IsSystemTx, "should omit IsSystemTx when false")
|
||||||
|
}
|
||||||
|
|
||||||
func TestUnmarshalRpcDepositTx(t *testing.T) {
|
func TestUnmarshalRpcDepositTx(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user