Skip to content

Conversation

@s1na
Copy link
Contributor

@s1na s1na commented Oct 24, 2022

This PR changes the pending tx subscription to return RPCTransaction types instead of normal Transaction objects. This will fix the inconsistencies with other tx returning API methods (i.e. getTransactionByHash), and also fill in the sender value for the tx.

Fixes #26030


// eth/filters needs to be initialized from this backend type, so methods needed by
// it must also be included here.
filters.Backend
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to avoid circular import. This happened because I had to import internal/ethapi for the RPCTransaction type.

// SubscribePendingTxs creates a subscription that writes transactions for
// transactions that enter the transaction pool.
func (es *EventSystem) SubscribePendingTxs(txs chan []*types.Transaction) *Subscription {
func (es *EventSystem) SubscribePendingTxs(txs chan []*ethapi.RPCTransaction) *Subscription {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that at this point - internally - we should not shuffle RPCTransaction objects. It's fine to convert to these types at the last step before returning to the user, but it's an RPC output nicety, Geth internally should not pass around RPC related types.

@s1na
Copy link
Contributor Author

s1na commented Nov 9, 2022

Closing in favor of #26126

@s1na s1na closed this Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return sender (and chainId) on 'eth_subscribe', ['newPendingTransactions', true]

3 participants