-
Notifications
You must be signed in to change notification settings - Fork 277
How to get value to put in &[GetBlockTemplateCapabilities] as an argument for get_block_template()? #219
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
Comments
Have a look at e.g. but I think the result you get form that RPC call to a v0.21 or newer node is currently broken. See #176. I'm running a patched version of this crate as the fix hasn't been merged yet. |
Also see the integration tests rust-bitcoincore-rpc/integration_test/src/main.rs Lines 1122 to 1130 in 657eebd
|
@0xB10C thank you very much, I was able to get it running. I'll share it here for good measure. If it belongs elsewhere, let me know. use bitcoincore_rpc::json::GetBlockTemplateModes::Template;
use bitcoincore_rpc::json::GetBlockTemplateRules::{Csv, SegWit, Signet, Taproot};
use bitcoincore_rpc::RpcApi;
use bitcoincore_rpc::{Auth, Client};
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let client = Client::new(
"http://127.0.0.1:38332",
Auth::UserPass("hello".to_string(), "there".to_string()),
)?;
let mode = Template;
let rules = &[Signet, SegWit, Taproot, Csv];
let capabilities = &[];
let rpc = client.get_block_template(mode, rules, capabilities)?;
rpc.transactions.iter().for_each(|a| println!("{:?}", a));
Ok(())
} |
Awesome! Feel free to close this issues if it's solved. |
I am trying to get the block template of my core node so I can implement this in rust.
https://code.samourai.io/oxt/one_dollar_fee_estimator/-/blob/master/one_dollar_fee_estimator/estimator.py
Below is my code that wont compile and I can't figure out how to use the rpc call correctly just from looking at the docs.
How would I supply the get block template call with the correct capabilities? Looks like I need to get a value from the enum to put in the array but I can't figure out how to invoke one from the docs.
This is the function signature that I copied from the docs.
fn get_block_template(
&self,
mode: GetBlockTemplateModes,
rules: &GetBlockTemplateRules[],
capabilities: &GetBlockTemplateCapabilities[]
) -> Result<GetBlockTemplateResult>
This is my code that I am trying to get running.
I also tried lookind up this example but I think its no longer valid (or at least it wont compile for me.
#163 (comment)
this is my cargo.toml for reference
Appreciate any pointers, not sure what I am doing wrong here.
The text was updated successfully, but these errors were encountered: