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

scan_tx_out_set_blocking() is panicking as if another scan is already in progress #361

Open
luisschwab opened this issue Jun 11, 2024 · 2 comments

Comments

@luisschwab
Copy link

rust-bitcoincore-rpc: v0.19.0
Bitcoin Core: v0.21.0 and v24.0.1

scan_tx_out_set_blocking() is panicking as if another scan was already in progress.

This snippet:

extern crate bitcoincore_rpc;
extern crate bitcoincore_rpc_json;

use bitcoincore_rpc::{Auth, Client, RpcApi};
use bitcoincore_rpc_json::ScanTxOutRequest;

fn main() {
    let rpc = Client::new("127.0.0.1",
            Auth::UserPass("satoshi".to_string(),
                           "satoshi".to_string())).unwrap();

    let scan_txout_request = ScanTxOutRequest::Single("pkh(02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5)".to_string());

    let utxos = rpc.scan_tx_out_set_blocking(&[scan_txout_request]).unwrap();
    
    println!("{:?}", utxos);
}

returns this error:

called `Result::unwrap()` on an `Err` value: JsonRpc(Rpc(RpcError { code: -8, message: "Scan already in progress, use action \"abort\" or \"status\"", data: None }))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I run $ bitcoin-cli scantxoutset abort before to make sure there is no scan in progress. After the panic, bitcoind continues the scan (confirmed via $ bitcoin-cli scantxoutset status).

@luisschwab
Copy link
Author

cc @notmandatory

@luisschwab
Copy link
Author

luisschwab commented Jun 19, 2024

It's actually making two identical requests, ~15 seconds apart:

This error is caused by the rust-jsonrpc upstream dependency, which implements a 15 second timeout for requests (see here).

This is not the expected behavior: it should simply wait and block until the scan is done. A simple fix is not obvious to me, besides increasing the DEFAULT_TIMEOUT on rust-jsonrpc/src/http/simple_http.rs to an absurd amount, which would invalidate it's functionality for every other RPC that doesn't take as long to complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant