feat: improve grpc get_balance response #6755
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
get_balance
response by implementing an event-driven balance cache update. All events that could change the balance are monitored and consecutive calls to the wallet backend are only made when the balance changed.pub enum TransactionEvent
.async fn stream_transaction_events
in the wallet grpc server.Closes #6754
Motivation and Context
When calling the wallet grpc method
get_balance
repeatedly and quickly in succession on wallets with many outputs, resources are wasted in the wallet when nothing changes, and the client experiences unnecessary long response times.How Has This Been Tested?
System-level testing on a large wallet with an external grpc client. See logs with response times below.
What process can a PR reviewer use to test or verify this change?
System-level testing with an external grpc client.
Breaking Changes