corepc_client/client_sync/v17/
mining.rs1#[macro_export]
14macro_rules! impl_client_v17__get_block_template {
15 () => {
16 impl Client {
17 pub fn get_block_template(
18 &self,
19 request: &TemplateRequest,
20 ) -> Result<GetBlockTemplate> {
21 self.call("getblocktemplate", &[into_json(request)?])
22 }
23 }
24 };
25}
26
27#[macro_export]
29macro_rules! impl_client_v17__get_mining_info {
30 () => {
31 impl Client {
32 pub fn get_mining_info(&self) -> Result<GetMiningInfo> {
33 self.call("getmininginfo", &[])
34 }
35 }
36 };
37}
38
39#[macro_export]
41macro_rules! impl_client_v17__get_network_hashes_per_second {
42 () => {
43 impl Client {
44 pub fn get_network_hash_ps(&self) -> Result<f64> { self.call("getnetworkhashps", &[]) }
45 }
46 };
47}
48
49#[macro_export]
51macro_rules! impl_client_v17__prioritise_transaction {
52 () => {
53 impl Client {
54 pub fn prioritise_transaction(
55 &self,
56 txid: &Txid,
57 fee_delta: bitcoin::SignedAmount,
58 ) -> Result<bool> {
59 let sats = fee_delta.to_sat();
60 self.call("prioritisetransaction", &[into_json(txid)?, 0.into(), sats.into()])
61 }
62 }
63 };
64}
65
66#[macro_export]
68macro_rules! impl_client_v17__submit_block {
69 () => {
70 impl Client {
71 pub fn submit_block(&self, block: &Block) -> Result<()> {
72 let hex: String = bitcoin::consensus::encode::serialize_hex(block);
73 match self.call("submitblock", &[into_json(hex)?]) {
74 Ok(serde_json::Value::Null) => Ok(()),
75 Ok(res) => Err(Error::Returned(res.to_string())),
76 Err(err) => Err(err.into()),
77 }
78 }
79 }
80 };
81}