File tree Expand file tree Collapse file tree 26 files changed +67
-13
lines changed Expand file tree Collapse file tree 26 files changed +67
-13
lines changed Original file line number Diff line number Diff line change
1
+ // SPDX-License-Identifier: CC0-1.0
2
+
3
+ //! Macros for implementing JSON-RPC methods on a client.
4
+ //!
5
+ //! Specifically this is methods found under the `== Mining ==` section of the
6
+ //! API docs of Bitcoin Core `v0.18`.
7
+ //!
8
+ //! All macros require `Client` to be in scope.
9
+ //!
10
+ //! See or use the `define_jsonrpc_minreq_client!` macro to define a `Client`.
11
+
12
+ /// Implements Bitcoin Core JSON-RPC API method `submitheader`.
13
+ #[ macro_export]
14
+ macro_rules! impl_client_v18__submit_header {
15
+ ( ) => {
16
+ impl Client {
17
+ pub fn submit_header( & self , header: & bitcoin:: block:: Header ) -> Result <( ) > {
18
+ let hexdata = bitcoin:: consensus:: encode:: serialize_hex( header) ;
19
+ match self . call( "submitheader" , & [ hexdata. into( ) ] ) {
20
+ Ok ( serde_json:: Value :: Null ) => Ok ( ( ) ) ,
21
+ Ok ( res) => Err ( Error :: Returned ( res. to_string( ) ) ) ,
22
+ Err ( err) => Err ( err. into( ) ) ,
23
+ }
24
+ }
25
+ }
26
+ } ;
27
+ }
Original file line number Diff line number Diff line change 5
5
//! We ignore option arguments unless they effect the shape of the returned JSON data.
6
6
7
7
pub mod control;
8
+ pub mod mining;
8
9
pub mod network;
9
10
pub mod raw_transactions;
10
11
pub mod util;
@@ -74,6 +75,7 @@ crate::impl_client_v17__get_mining_info!();
74
75
crate :: impl_client_v17__get_network_hashes_per_second!( ) ;
75
76
crate :: impl_client_v17__prioritise_transaction!( ) ;
76
77
crate :: impl_client_v17__submit_block!( ) ;
78
+ crate :: impl_client_v18__submit_header!( ) ;
77
79
78
80
// == Network ==
79
81
crate :: impl_client_v17__add_node!( ) ;
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ crate::impl_client_v17__get_mining_info!();
71
71
crate :: impl_client_v17__get_network_hashes_per_second!( ) ;
72
72
crate :: impl_client_v17__prioritise_transaction!( ) ;
73
73
crate :: impl_client_v17__submit_block!( ) ;
74
+ crate :: impl_client_v18__submit_header!( ) ;
74
75
75
76
// == Network ==
76
77
crate :: impl_client_v17__add_node!( ) ;
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ crate::impl_client_v17__get_mining_info!();
68
68
crate :: impl_client_v17__get_network_hashes_per_second!( ) ;
69
69
crate :: impl_client_v17__prioritise_transaction!( ) ;
70
70
crate :: impl_client_v17__submit_block!( ) ;
71
+ crate :: impl_client_v18__submit_header!( ) ;
71
72
72
73
// == Network ==
73
74
crate :: impl_client_v17__add_node!( ) ;
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ crate::impl_client_v17__get_mining_info!();
70
70
crate :: impl_client_v17__get_network_hashes_per_second!( ) ;
71
71
crate :: impl_client_v17__prioritise_transaction!( ) ;
72
72
crate :: impl_client_v17__submit_block!( ) ;
73
+ crate :: impl_client_v18__submit_header!( ) ;
73
74
74
75
// == Network ==
75
76
crate :: impl_client_v17__add_node!( ) ;
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ crate::impl_client_v17__get_mining_info!();
70
70
crate :: impl_client_v17__get_network_hashes_per_second!( ) ;
71
71
crate :: impl_client_v17__prioritise_transaction!( ) ;
72
72
crate :: impl_client_v17__submit_block!( ) ;
73
+ crate :: impl_client_v18__submit_header!( ) ;
73
74
74
75
// == Network ==
75
76
crate :: impl_client_v17__add_node!( ) ;
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ crate::impl_client_v17__get_mining_info!();
72
72
crate :: impl_client_v17__get_network_hashes_per_second!( ) ;
73
73
crate :: impl_client_v17__prioritise_transaction!( ) ;
74
74
crate :: impl_client_v17__submit_block!( ) ;
75
+ crate :: impl_client_v18__submit_header!( ) ;
75
76
76
77
// == Network ==
77
78
crate :: impl_client_v17__add_node!( ) ;
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ crate::impl_client_v17__get_mining_info!();
69
69
crate :: impl_client_v17__get_network_hashes_per_second!( ) ;
70
70
crate :: impl_client_v17__prioritise_transaction!( ) ;
71
71
crate :: impl_client_v17__submit_block!( ) ;
72
+ crate :: impl_client_v18__submit_header!( ) ;
72
73
73
74
// == Network ==
74
75
crate :: impl_client_v17__add_node!( ) ;
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ crate::impl_client_v17__get_mining_info!();
69
69
crate :: impl_client_v17__get_network_hashes_per_second!( ) ;
70
70
crate :: impl_client_v17__prioritise_transaction!( ) ;
71
71
crate :: impl_client_v17__submit_block!( ) ;
72
+ crate :: impl_client_v18__submit_header!( ) ;
72
73
73
74
// == Network ==
74
75
crate :: impl_client_v17__add_node!( ) ;
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ crate::impl_client_v17__get_network_hashes_per_second!();
74
74
crate :: impl_client_v26__get_prioritised_transactions!( ) ;
75
75
crate :: impl_client_v17__prioritise_transaction!( ) ;
76
76
crate :: impl_client_v17__submit_block!( ) ;
77
+ crate :: impl_client_v18__submit_header!( ) ;
77
78
78
79
// == Network ==
79
80
crate :: impl_client_v17__add_node!( ) ;
You can’t perform that action at this time.
0 commit comments