Add a electrum syncing example#77
Conversation
Codecov Report
@@ Coverage Diff @@
## master #77 +/- ##
=======================================
Coverage 59.39% 59.39%
=======================================
Files 8 8
Lines 266 266
=======================================
Hits 158 158
Misses 108 108
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
ea42c4b to
3542c3d
Compare
|
Restructured the commit to handle #72 requirements.
|
|
Me and @evanlinjin tend to disagree on the approach of the consistency assertion.. While to me it seems the best place to apply it is the update API, Evan thinks there could be a better approach.. Opening this up for discussion and reviews.. |
03b7d94 to
605abf8
Compare
|
Rebased on current master, and updated the example syncing with recent invariants around |
605abf8 to
7ebd627
Compare
|
Updated with the above suggestions.
Q: What to do when we only have
|
7ebd627 to
a39916e
Compare
Haven't reviewed just comment: we don't keep the index for |
ba92c75 to
056979e
Compare
Done.. |
LLFourn
left a comment
There was a problem hiding this comment.
Thanks @rajarshimaitra. Looks great. A few minor requests to finish this off. The main thing that's missing is to protect against re-org during sync.
Yes.. I tried to add this into a separate function but that's making the code more complicated, because many trait bounds needs to be satisfied for the |
LLFourn
left a comment
There was a problem hiding this comment.
I just took another pass at this. The list of things I've proposed to fix here is final now I think.
837b0e7 to
e582098
Compare
|
Thanks @LLFourn for the comments.. Updated as suggested and used the new API.. modulo #77 (comment).. Code looks much simpler.. |
42e151d to
b60d4e1
Compare
LLFourn
left a comment
There was a problem hiding this comment.
Look great @rajarshimaitra. Main things:
- use batch calls to electrum
- Intead of matching every error and then throwing a new anyhow error just use
anyhow::Context::context - Remove function
complete_updatein favor of just getting thenew_sparsechainfrom the match arms and doing the update from there like what @evanlinjin does here: https://github.com/LLFourn/bdk_core_staging/pull/107/files#diff-6f57072cac1464050942f5bf972a9a8f76cb82a151f93f5b5d16cab1515f925aR74
|
@LLFourn updated with the suggestions, module #77 (comment). Let me know if this looks good and you want the the commit history squashed.. |
2d6c375 to
07cd6bb
Compare
|
Sqaushed and rebased on master.. |
07cd6bb to
c6f0aef
Compare
|
I just did some work to get this working:
Check it out @rajarshimaitra. This is working and probably ready to merge with final review from @evanlinjin. |
- break at the right time in the loop - add signet electrum server - print out syncing progress - Make client configurable - Stop returning the sparse chain from inflate_changeset because it makes it harder to ? the error and you can just clone it if you still need it on failure.
f5fe15a to
3531907
Compare
3531907 to
c6f0aef
Compare
|
@rajarshimaitra You forced-pushed away the changes... |
|
Holy shit.. |
c6f0aef to
3531907
Compare
|
@rajarshimaitra Fixed. |
|
Sorry dude.. Intended to just push a nit.. Fat fingered.. |
evanlinjin
left a comment
There was a problem hiding this comment.
ACK 3531907
Just some nits
* Remove unnecessary code * Check `index` is greater than `last_active_index` before changing `last_active_index`
This PR adds an electrum syncing example.. Fixes #72
The electrum sync is done in two steps.
wallet_txid_scanreturns a candidateKeychainScanwith TxGraph data.SparseChain, and list of new tx data to fetch is derived from theChangeSet.KeychainScanupdate.KeychainScanon tracker and DB.