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

Trouble generating blocks. #16

Closed
rajarshimaitra opened this issue Apr 11, 2024 · 1 comment
Closed

Trouble generating blocks. #16

rajarshimaitra opened this issue Apr 11, 2024 · 1 comment

Comments

@rajarshimaitra
Copy link

I am currently trying to use elementsd to create a regtest integration test framework.

I have the following code trying to generate new regtest blocks.

let elementsd = ElementsD::new(downloaded_exe_path().unwrap()).unwrap();

        let mining_address = elementsd
            .client()
            .call::<Value>("getnewaddress", &[])
            .unwrap()
            .to_string();

        elementsd.client().call::<Value>("generatetoaddress", &[101.into(), mining_address.into()]).unwrap();

This is error with the following msg:
called Result::unwrap() on an Err value: JsonRpc(Rpc(RpcError { code: -5, message: "Error: Invalid address", data: None })).

Any idea or hint on what I am doing wrong would be very helpful.

@rajarshimaitra
Copy link
Author

This is solved by omitting the string conversion.

let mining_address = self.elementsd
            .client()
            .call::<Value>("getnewaddress", &[])
            .unwrap();

        self.elementsd.client().call::<Value>("generatetoaddress", &[n.into(), mining_address]).unwrap();

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