Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions pkg/client/txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ type RPCTransaction struct {
YParity *hexutil.Uint64 `json:"yParity,omitempty"`
}

// ContentFrom calls `txpool_contentFrom` of the Ethereum RPC
func ContentFrom(ctx context.Context, client *ethclient.Client, address common.Address) (map[string]map[string]*RPCTransaction, error) {
var res map[string]map[string]*RPCTransaction
if err := client.Client().CallContext(ctx, &res, "txpool_contentFrom", address); err != nil {
return nil, err
}
return res, nil
}

// PendingTransactions returns pending txs sent from `address` sorted by nonce.
func PendingTransactions(ctx context.Context, client *ethclient.Client, address common.Address) ([]*RPCTransaction, error) {
txs, err := ContentFrom(ctx, client, address)
Expand Down
24 changes: 24 additions & 0 deletions pkg/client/txpool/txpool_content_from.debug.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//go:build ethereum_ibc_relay_chain_debug

package txpool

import (
"os"
"context"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
)

// ContentFrom calls `txpool_contentFrom` of the Ethereum RPC
func ContentFrom(ctx context.Context, client *ethclient.Client, address common.Address) (map[string]map[string]*RPCTransaction, error) {
res := make(map[string]map[string]*RPCTransaction)
val, ok := os.LookupEnv("RELAYER_SKIP_TXPOOL_CONTENT_FROM")
if ok && val == "1" {
} else {
if err := client.Client().CallContext(ctx, &res, "txpool_contentFrom", address); err != nil {
return nil, err
}
}
return res, nil
}
19 changes: 19 additions & 0 deletions pkg/client/txpool/txpool_content_from.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//go:build !ethereum_ibc_relay_chain_debug

package txpool

import (
"context"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
)

// ContentFrom calls `txpool_contentFrom` of the Ethereum RPC
func ContentFrom(ctx context.Context, client *ethclient.Client, address common.Address) (map[string]map[string]*RPCTransaction, error) {
var res map[string]map[string]*RPCTransaction
if err := client.Client().CallContext(ctx, &res, "txpool_contentFrom", address); err != nil {
return nil, err
}
return res, nil
}