kaspad icon indicating copy to clipboard operation
kaspad copied to clipboard

RPC: add client side ids to notification listeners.

Open D-Stacks opened this issue 2 years ago • 1 comments

this has been requested by devs in the discord development channel, specfically for kdx, and perhaps for usage in the vitex gateway?

it allows, for example, kaspad clients which handle multiple users, to differentiate the kaspad stream responses specific for each user.

To Do:

  • [x] add to and from kaspadmessage Id conversion
  • [x] add Register...WithId to kaspad rpcclient, for id usage in the native client.
  • [x] add tests.

on a further note, it can be used to perhaps create a new listener with each id requested, but may be for further development based on this pr, but beyond the scope of this pr itself.

I also hope some of the code can be used for future rpc reworks.

Note: currently I believe this only works for situations where clients intiate a seperate rpc connection, for each notification stream.

D-Stacks avatar Jun 16 '22 07:06 D-Stacks

Codecov Report

Merging #2085 (41cb5f5) into dev (b9093d5) will increase coverage by 0.34%. The diff coverage is 67.33%.

:exclamation: Current head 41cb5f5 differs from pull request most recent head 93d9a75. Consider uploading reports for the commit 93d9a75 to get more accurate results

@@            Coverage Diff             @@
##              dev    #2085      +/-   ##
==========================================
+ Coverage   59.19%   59.54%   +0.34%     
==========================================
  Files         678      678              
  Lines       32831    33071     +240     
==========================================
+ Hits        19434    19691     +257     
+ Misses      10596    10527      -69     
- Partials     2801     2853      +52     
Impacted Files Coverage Δ
app/appmessage/rpc_stop_notifying_utxos_changed.go 0.00% <0.00%> (ø)
...stop_notifying_pruning_point_utxo_set_overrides.go 0.00% <0.00%> (ø)
...pp/rpc/rpchandlers/stop_notifying_utxos_changed.go 0.00% <0.00%> (ø)
...rver/protowire/rpc_stop_notifying_utxos_changed.go 0.00% <0.00%> (ø)
...pcclient/rpc_on_pruning_point_utxo_set_override.go 38.70% <41.66%> (-3.23%) :arrow_down:
...wire/rpc_notify_pruning_point_utxo_set_override.go 36.36% <43.47%> (+0.29%) :arrow_up:
app/appmessage/rpc_notify_finality_conflicts.go 40.00% <50.00%> (+40.00%) :arrow_up:
...cserver/protowire/rpc_notify_finality_conflicts.go 34.32% <52.94%> (+34.32%) :arrow_up:
...ure/network/rpcclient/rpc_on_finality_conflicts.go 29.31% <56.66%> (+29.31%) :arrow_up:
...sage/rpc_notify_pruning_point_utxo_set_override.go 60.00% <60.00%> (ø)
... and 60 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 b9093d5...93d9a75. Read the comment docs.

codecov[bot] avatar Jun 16 '22 08:06 codecov[bot]