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

feat: streaming history sync #706

Merged
merged 24 commits into from
Jul 23, 2024
Merged

feat: streaming history sync #706

merged 24 commits into from
Jul 23, 2024

Conversation

r4mmer
Copy link
Member

@r4mmer r4mmer commented Jul 16, 2024

Streamming history sync

The client will send a request:history:<method> where method is either xpub or manual to start syncing the history of a wallet through the websocket connection with the fullnode.
The difference between xpub and manual modes is that in xpub mode we send the xpubkey and the addresses are derived on the fullnode and on manual mode we derive the addresses and send the list of addresses the fullnode has to iterate over.

Once the stream starts the fullnode will start streaming the addresses and history.

It will send stream:history:address with an address, this marks the end of the history from the last address.
All transactions after this will be on this address history (until the next address event is received).

It will send stream:history:vertex with a transaction on the wallet history.

It will send stream:history:end when all addresses and transactions were sent.

It will send a stream:history:error when an error happens on the fullnode and we should stop the streamming.

Acceptance Criteria

  • Allow configuring a wallet to use another method of history sync.
  • Implement a streamming history sync method (client to the API implemented here).
  • Create tests with a mocked websocket server implementation.

Security Checklist

  • Make sure you do not include new dependencies in the project unless strictly necessary and do not include dev-dependencies as production ones. More dependencies increase the possibility of one of them being hijacked and affecting us.

@r4mmer r4mmer requested review from msbrogli and glevco July 16, 2024 22:05
@r4mmer r4mmer self-assigned this Jul 16, 2024
@r4mmer r4mmer requested a review from pedroferreira1 as a code owner July 16, 2024 22:05
Copy link

codecov bot commented Jul 16, 2024

Codecov Report

Attention: Patch coverage is 86.25592% with 29 lines in your changes missing coverage. Please review.

Project coverage is 80.42%. Comparing base (0e689ed) to head (8fe87ef).

Files Patch % Lines
src/sync/stream.ts 86.20% 20 Missing ⚠️
src/new/connection.ts 78.94% 8 Missing ⚠️
src/new/wallet.js 94.11% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #706       +/-   ##
===========================================
+ Coverage   63.52%   80.42%   +16.90%     
===========================================
  Files          77       78        +1     
  Lines        5957     6156      +199     
  Branches     1303     1341       +38     
===========================================
+ Hits         3784     4951     +1167     
+ Misses       2075     1187      -888     
+ Partials       98       18       -80     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@r4mmer r4mmer requested a review from msbrogli July 19, 2024 16:37
glevco
glevco previously approved these changes Jul 23, 2024
msbrogli
msbrogli previously approved these changes Jul 23, 2024
@r4mmer r4mmer dismissed stale reviews from msbrogli and glevco via 751e4d0 July 23, 2024 16:30
msbrogli
msbrogli previously approved these changes Jul 23, 2024
@r4mmer r4mmer merged commit 1fea29a into master Jul 23, 2024
4 checks passed
@r4mmer r4mmer deleted the feat/streaming-history-sync branch July 23, 2024 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants