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

Add AcceptedTransactionIDs to ChainChanged notification and VirtualSelectedParentChain RPC #2036

Merged
merged 13 commits into from
May 5, 2022

Conversation

svarogg
Copy link
Collaborator

@svarogg svarogg commented Apr 26, 2022

This PR was requested by TxBit, since it's complicated for them to follow balances tracking UTXO changes.

And example usage can be seen at: https://github.com/svarogg/kaspadotnet/blob/main/Kaspadotnet.Examples/FollowTransactions.cs

app/rpc/manager.go Show resolved Hide resolved
@@ -196,7 +196,7 @@ func (m *Manager) notifyVirtualSelectedParentChainChanged(virtualChangeSet *exte
defer onEnd()

notification, err := m.context.ConvertVirtualSelectedParentChainChangesToChainChangedNotificationMessage(
virtualChangeSet.VirtualSelectedParentChainChanges)
virtualChangeSet.VirtualSelectedParentChainChanges, true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You're populating the notification with tx data even if the user didn't subscribe to RPC notifications. I guess it could be a heavy operation.

@codecov
Copy link

codecov bot commented May 1, 2022

Codecov Report

Merging #2036 (ebe1823) into dev (1660cf0) will increase coverage by 0.11%.
The diff coverage is 89.25%.

@@            Coverage Diff             @@
##              dev    #2036      +/-   ##
==========================================
+ Coverage   59.38%   59.49%   +0.11%     
==========================================
  Files         675      675              
  Lines       32211    32296      +85     
==========================================
+ Hits        19127    19213      +86     
+ Misses      10333    10324       -9     
- Partials     2751     2759       +8     
Impacted Files Coverage Δ
...pc_get_virtual_selected_parent_chain_from_block.go 64.81% <68.75%> (-0.19%) ⬇️
app/rpc/rpccontext/chain_changed.go 87.09% <84.00%> (-12.91%) ⬇️
app/rpc/rpccontext/notificationmanager.go 65.21% <89.47%> (+2.12%) ⬆️
app/rpc/manager.go 69.23% <90.90%> (+3.51%) ⬆️
...pc_get_virtual_selected_parent_chain_from_block.go 100.00% <100.00%> (ø)
...pc_notify_virtual_selected_parent_chain_changed.go 100.00% <100.00%> (ø)
...rs/get_virtual_selected_parent_chain_from_block.go 47.61% <100.00%> (+5.51%) ⬆️
...rs/notify_virtual_selected_parent_chain_changed.go 77.77% <100.00%> (+6.34%) ⬆️
...pc_notify_virtual_selected_parent_chain_changed.go 73.58% <100.00%> (+6.14%) ⬆️
...ture/network/rpcclient/rpc_get_chain_from_block.go 50.00% <100.00%> (+4.54%) ⬆️
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1660cf0...ebe1823. Read the comment docs.

virtualChangeSet.VirtualSelectedParentChainChanges, true)
if err != nil {
return err
if m.context.NotificationManager.DoesAnyListenerPropagateVirtualSelectedParentChainChanged() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you also check if one of the listeners asked for transactions?

@someone235 someone235 merged commit 52fbeed into kaspanet:dev May 5, 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.

2 participants