mirror of
https://github.com/status-im/op-geth.git
synced 2025-02-12 14:56:23 +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()
|
||||
isSystemTx := tx.IsSystemTx()
|
||||
result.SourceHash = &srcHash
|
||||
result.IsSystemTx = &isSystemTx
|
||||
if isSystemTx {
|
||||
// Only include IsSystemTx when true
|
||||
result.IsSystemTx = &isSystemTx
|
||||
}
|
||||
result.Mint = (*hexutil.Big)(tx.Mint())
|
||||
if receipt != nil && receipt.DepositNonce != nil {
|
||||
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)
|
||||
}
|
||||
|
||||
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) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
Loading…
x
Reference in New Issue
Block a user