-
Notifications
You must be signed in to change notification settings - Fork 318
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
Update bitcoind to v0.23.0 #613
Update bitcoind to v0.23.0 #613
Conversation
Fix wallet creation in rpc blockchain.
Reported the problem to bitcoincore-rpc rust-bitcoin/rust-bitcoincore-rpc#225 |
Code looks good but there are a couple of tests timing out, were they working locally on your machine? |
Yes I can see them in local too.. Opened this up to start the discussion of fixing the rpc api.. There might be many things off with |
I am seeing weird intermittent test failure.. Sometimes the tests are blocking on something so they are getting timed out, and sometimes tests are throwing "resource unavailable" error..
The errors are not consistent.. Different tests are erroring at different runs.. Still trying to figure whats going on.. |
I've been looking into the tests that failed in CI. Different tests are timing out when I run it locally but I suspect the causes are related, the one that I'm looking into that hangs on my local system is RUST_LOG=trace cargo test --no-default-features --features test-electrum,verify blockchain::electrum::test::bdk_blockchain_tests::test_sync_reorg_block For this one, after calling I'm going to keep trying to figure it out, but if anyone has any suggestions let me know. |
Thanks @notmandatory .. I have also witnessed almost of all of the test pausing in my local is causing by either I am also honing into that something is going wrong in the electrs sync.. But I suspect in that case the bug might be lying deep inside electrs and its only occuring for ccing @RCasatta here if he can share any more suggestions to identify the bug.. |
I was able to get all the tests to pass except The |
Thanks.. That sounds like at least some progress. I haven't been able to get any closer. If you have the code handy with your change can you push into this PR?? I will try to see if I can dig there deeper and find something. |
I made a little more progress today, but still not clear on a proper fix. What I found is that in the if let Err(e) = reader.read_line(&mut raw_resp) { The hang seems to happen after sending a "blockchain.scripthash.get_history" request to the server, after invalidating a block on bitcoind. I tried adding a timeout to the electrum |
Yes, I would like to fix this for the next release because Core 23.0 has been out for a while and we are still not compatible with it. I can work on another PR to migrate our rpc client to use descriptor wallets, so that it can at least work with all the Core versions. For the time being we can continue testing against 22.0 and once we have a fix for the tests upgrade those to 23.0 |
Are you saying that even if you subscribe to headers update you never receive any? Because that sounds like a bug in electrs |
No, you still get the header update but only in the result of the |
e1a1372 rpc: use `importdescriptors` with Core >= 0.21 (Alekos Filini) Pull request description: ### Description Only use the old `importmulti` with Core versions that don't support descriptor-based (sqlite) wallets. Add an extra feature to test against Core 0.20 called `test-rpc-legacy`. This also makes us compatible with Core 23.0 and is thus a replacement for #613, which actually looking back at it was adding support for 23.0 but probably breaking older wallets by adding the extra argument to `createwallet`. I believe #613 should now only focus on getting the tests to work against 23.0, which is still important but not such a high priority as being compatible with the latest version of Core. Also fixes #598 ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing #### New Features: * [x] I've added tests for the new feature * [x] I've added docs for the new feature * [x] I've updated `CHANGELOG.md` ACKs for top commit: notmandatory: ACK e1a1372 Tree-SHA512: 7891b8ab2fc900ea2a186f64a32aea970f28a50339063ed0e1a8d13248e5c038b8fff3d9e26b93cb7daafd0c873379e64a28836dbe4e4b82f1983577a88971ff
But the headers_subscribe call should not only send you the latest header immediately, it should also notify you when new blocks come in, without having to poll the server constantly. So if you generate a new block on Core electrs should notify you and that notification should end up in the queue that It's either electrs not sending it or rust-electrum-client missing it for some reason, which would be weird since it worked fine for months now. Btw, if you run the code with debug log level rust-electrum-client should print all the raw messages coming in and out, so if electrs sends the notification you should see it there at least, as long as there's a thread reading from the tcp socket |
The way the In newer versions of |
I was able to fix the fn wait_for_block(&mut self, min_height: usize) {
let mut header = self.electrsd.client.block_headers_subscribe().unwrap();
loop {
if header.height >= min_height {
break;
}
header = exponential_backoff_poll(|| {
self.electrsd.trigger().unwrap();
self.electrsd.client.ping().unwrap();
self.electrsd.client.block_headers_pop().unwrap()
});
}
} But then I get a different electrs problem where it receives a "blockchain.scripthash.get_history" but then returns no data back, which causes the test to hang on the next |
So I think the way you've patched But with your changes we correctly account for the case where electrs has already processed the blocks and can send us the header right away. The fact that |
I suspect there may be more wrong with I'm going to keep paying around with it.. and see if I can verify the correct behavior using a different electrum server like electrum personal server. If it looks like an issue with I'm putting my testing notes here: |
I tried fixing this in rust-bitcoin/rust-bitcoincore-rpc#230, however my changes seemed to have broken backwards-compatibility and I need to fix the tests. |
Thanks @evanlinjin for working on this.. Yes the API has to be changed there.. Let me know when you finalize the PR.. I will review and test it out.. |
Hey, we are in the process of releasing BDK 1.0, which will under the hood work quite differently from the current BDK. For this reason, I'm closing all the PRs that don't really apply anymore. If you think this is a mistake, feel free to rebase on master and re-open! |
Description
Fixes #598
Thanks @afilini for sugesting to update electrs version. That did the trick..
But unfortunately electrs v0.9.1 isn't working with bitcoind v0.22.0. So I have updated the backend to v0.23.0 too.
Also reported the
create_wallet
api inconsistency for bitcoincore-rpc here rust-bitcoin/rust-bitcoincore-rpc#225Notes to the reviewers
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingBugfixes: