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

Fix GetMempoolTx bug returning no entries #404

Merged
merged 1 commit into from
Jul 21, 2022

Conversation

LarryRuane
Copy link
Collaborator

This was broken by PR #393, which changed how txids are determined. After GetMempoolTx fetches individual transactions, they're converted to compact format, one attribute of which is transaction ID (txid), and that wasn't being filled in. This prevented any entries from being returned (see test at

if len(tx.Hash) > 0 {
)

Note that this gRPC is probably not being widely used; the ECC wallets use the more recent (and arguably superior) GetMempoolStream.

@LarryRuane
Copy link
Collaborator Author

Force-pushed to eliminate some GetMempoolStream logging, which is more like debug logging, should not be there. I noticed this while investigating #401, and this change isn't worth its own separate PR.

This was broken by PR 393, which changed how txids are determined.
@LarryRuane LarryRuane force-pushed the 2022-07-GetMempoolTx-no-entries branch from 8f89fc0 to cc9f922 Compare July 21, 2022 17:19
@LarryRuane
Copy link
Collaborator Author

Force-pushed a small code simplification (no functional effect).

@@ -466,6 +466,11 @@ func (s *lwdStreamer) GetMempoolTx(exclude *walletrpc.Exclude, resp walletrpc.Co
}
newmempoolMap[txidstr] = &walletrpc.CompactTx{}
if tx.HasShieldedElements() {
txidBytes, err := hex.DecodeString(txidstr)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In a future PR, we could make newmempoolMap more space-efficient by changing its key type to slice of bytes, rather than string. Then we wouldn't have to decode back to bytes here (but we would have to encode to string elsewhere). It's not too bad as it currently is, however, because the mempool typically doesn't have many entries.

@LarryRuane LarryRuane merged commit af0f348 into zcash:master Jul 21, 2022
@LarryRuane LarryRuane deleted the 2022-07-GetMempoolTx-no-entries branch July 21, 2022 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mempool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant