Skip to content

Commit

Permalink
feat: add fullTx params to NewPendingTransactions (#9204)
Browse files Browse the repository at this point in the history
feat: add `fullTx` params to `NewPendingTransactions`

Closes #9203
  • Loading branch information
fenghaojiang authored Apr 25, 2024
1 parent 341bfea commit b9ebb6c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions turbo/jsonrpc/eth_filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (api *APIImpl) NewHeads(ctx context.Context) (*rpc.Subscription, error) {
}

// NewPendingTransactions send a notification each time when a transaction had added into mempool.
func (api *APIImpl) NewPendingTransactions(ctx context.Context) (*rpc.Subscription, error) {
func (api *APIImpl) NewPendingTransactions(ctx context.Context, fullTx *bool) (*rpc.Subscription, error) {
if api.filters == nil {
return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
}
Expand All @@ -183,7 +183,13 @@ func (api *APIImpl) NewPendingTransactions(ctx context.Context) (*rpc.Subscripti
case txs, ok := <-txsCh:
for _, t := range txs {
if t != nil {
err := notifier.Notify(rpcSub.ID, t.Hash())
var err error
if fullTx != nil && *fullTx {
err = notifier.Notify(rpcSub.ID, t)
} else {
err = notifier.Notify(rpcSub.ID, t.Hash())
}

if err != nil {
log.Warn("[rpc] error while notifying subscription", "err", err)
}
Expand Down

0 comments on commit b9ebb6c

Please sign in to comment.