-
Notifications
You must be signed in to change notification settings - Fork 390
[blockchain] Add support for pruned RPC blockchain #631
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
Conversation
I'm not adding any review comments since I can see this is still at the beginning, I'm just gonna say (as you've probably already realized) that ideally we should try to reuse all the common code with the normal rpc blockchain (for example I can see that you've made a copy of the I'll let you work on the implementation of setup/sync now, if once you are done we can see that the struct definition is very similar with For example, we could end up with But we'll talk about this later on, I think you are taking the right approach right now: it's better to copy/paste initially and just focus on the implementation and then see if we can share some of the code. |
Yeah, right now, I am copy pasting much of the structures because I suspect that when I start implementing or optimising the wallet setup and sync traits, additional information could be useful. Apart from that, since both these features are still experimental and the RPC API for pruned nodes can also be subjected to quite a few changes, I believe it would be better if we keep them separated in the future as well. |
Yeah that's a good point, let's see how the code looks once we are done and then we'll decide. |
7953e12
to
a662ffb
Compare
831a311
to
40b170c
Compare
I'm wondering whether a separate Blockchain implementation makes sense or whether we should find a way to have We can check whether Core is pruned or not via |
As the code has evolved, I too have notices that having a separate class for it is an overkill. The changes essentially boil down to calling a different RPC for the pruned node ( I am trying to find the bug in my code right now and plan to integrate it into the RPC class moving forward after discussing it with @afilini Any help in the debugging process is appreciated since I am a bit lost where I went wrong :/ |
@kjain1810 I'll have a look this weekend and see how I can help. Note that RpcBlockchain got a complete rewrite (merged in master) that fixes multiple bugs. The code potentially may be cleaner to work with and base your changes on (but please discuss with @afilini to see what he recommends as the better approach). |
@kjain1810 Which bug are you referring to? Currently tests are failing with:
Have you looked into which RPC calls are resulting in this error? (hint: it's Things that are good to know/figure out:
|
@evanlinjin
I think I forgot to mention this earlier but I am testing with the command cargo test --features test-pruned-rpc-legacy |
@kjain1810 it is great that you identified this. Do you know what steps you need to take to debug this? |
@evanlinjin i went through the documentation of this call and how bitcoincore_rpc calls it but couldn't find the error Lost on what other steps i can take now |
@kjain1810 |
@evanlinjin yeah both of them seem to be working on v22 |
@kjain1810 that's great. What version of |
The same as for |
@kjain1810 not really: https://github.com/bitcoindevkit/bdk/pull/631/files#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542R95 It's called |
@kjain1810 Are you still planning to continue with this? If so, I personally think it is better to base changes on the current implementation of rpc blockchain (it has basically been rewritten). I would close this PR for now if there is no further objections. |
Closing this for now (we have too many open and abandoned PRs), but feel free to re-open if needed :) |
Description
Current
RpcBlockchain
grants full access to transaction history, however, it requires a non-pruned node (a node storing the full blockchain, which at the time of writing is over 400GB).However, even without a wallet's full transaction history it is still possible to compute the wallet balance and be able to spend with only a pruned core full node.
The key to achieve that is using RPC method
scantxoutset
This PR implements
blockchain::rpc::PrunedRpcBlockchain
andblockchain::rpc::PrunedRpcConfig
for the same and usescantxout
to compute the wallet balance.Implements #530
Notes to the reviewers
This is currently a draft PR
This PR is a part of my project for Summer of Bitcoin 2022. My project mentors are @afilini and @RCasatta .
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
CHANGELOG.md