Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth/filters: return sender in pending tx subscription #26034

Closed
wants to merge 2 commits into from

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

@@ -89,7 +89,12 @@ type Backend interface {

// 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.

@@ -371,7 +374,7 @@ func (es *EventSystem) SubscribeNewHeads(headers chan *types.Header) *Subscripti

// 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