From 4a69d7607d58685e8f045ff2035d7e8c7f93203e Mon Sep 17 00:00:00 2001 From: lmittmann Date: Tue, 28 Jun 2022 12:59:15 +0200 Subject: [PATCH] made `fullTx` arg optional to keep backwards compatibility --- eth/filters/api.go | 4 ++-- ethclient/gethclient/gethclient.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eth/filters/api.go b/eth/filters/api.go index 61d9b8feee68..4612e4698719 100644 --- a/eth/filters/api.go +++ b/eth/filters/api.go @@ -136,7 +136,7 @@ func (api *FilterAPI) NewPendingTransactionFilter() rpc.ID { // NewPendingTransactions creates a subscription that is triggered each time a // transaction enters the transaction pool. If fullTx is true the full tx is // sent to the client, otherwise the hash is sent. -func (api *FilterAPI) NewPendingTransactions(ctx context.Context, fullTx bool) (*rpc.Subscription, error) { +func (api *FilterAPI) NewPendingTransactions(ctx context.Context, fullTx *bool) (*rpc.Subscription, error) { notifier, supported := rpc.NotifierFromContext(ctx) if !supported { return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported @@ -154,7 +154,7 @@ func (api *FilterAPI) NewPendingTransactions(ctx context.Context, fullTx bool) ( // To keep the original behaviour, send a single tx hash in one notification. // TODO(rjl493456442) Send a batch of tx hashes in one notification for _, tx := range txs { - if fullTx { + if fullTx != nil && *fullTx { notifier.Notify(rpcSub.ID, tx) } else { notifier.Notify(rpcSub.ID, tx.Hash()) diff --git a/ethclient/gethclient/gethclient.go b/ethclient/gethclient/gethclient.go index bce81ea6b376..fccaab800da4 100644 --- a/ethclient/gethclient/gethclient.go +++ b/ethclient/gethclient/gethclient.go @@ -182,7 +182,7 @@ func (ec *Client) SubscribePendingTransactions(ctx context.Context, ch chan<- *t // SubscribePendingTransactionHashes subscribes to new pending transaction hashes. func (ec *Client) SubscribePendingTransactionHashes(ctx context.Context, ch chan<- common.Hash) (*rpc.ClientSubscription, error) { - return ec.c.EthSubscribe(ctx, ch, "newPendingTransactions", false) + return ec.c.EthSubscribe(ctx, ch, "newPendingTransactions") } func toBlockNumArg(number *big.Int) string {