@@ -15,6 +15,7 @@ pub mod v25;
1515pub mod v26;
1616pub mod v27;
1717pub mod v28;
18+ pub mod v29;
1819
1920use std:: fs:: File ;
2021use std:: io:: { BufRead , BufReader } ;
@@ -177,15 +178,21 @@ where
177178
178179/// Shorthand for `serde_json::Value::Null`.
179180#[ allow( dead_code) ] // TODO: Remove this if unused still when we are done.
180- fn null ( ) -> serde_json:: Value { serde_json:: Value :: Null }
181+ fn null ( ) -> serde_json:: Value {
182+ serde_json:: Value :: Null
183+ }
181184
182185/// Shorthand for an empty `serde_json::Value` array.
183186#[ allow( dead_code) ] // TODO: Remove this if unused still when we are done.
184- fn empty_arr ( ) -> serde_json:: Value { serde_json:: Value :: Array ( vec ! [ ] ) }
187+ fn empty_arr ( ) -> serde_json:: Value {
188+ serde_json:: Value :: Array ( vec ! [ ] )
189+ }
185190
186191/// Shorthand for an empty `serde_json` object.
187192#[ allow( dead_code) ] // TODO: Remove this if unused still when we are done.
188- fn empty_obj ( ) -> serde_json:: Value { serde_json:: Value :: Object ( Default :: default ( ) ) }
193+ fn empty_obj ( ) -> serde_json:: Value {
194+ serde_json:: Value :: Object ( Default :: default ( ) )
195+ }
189196
190197/// Convert a possible-null result into an `Option`.
191198#[ allow( dead_code) ] // TODO: Remove this if unused still when we are done.
@@ -205,11 +212,12 @@ fn log_response(method: &str, resp: &Result<jsonrpc::Response>) {
205212
206213 if log:: log_enabled!( Warn ) || log:: log_enabled!( Debug ) || log:: log_enabled!( Trace ) {
207214 match resp {
208- Err ( ref e) =>
215+ Err ( ref e) => {
209216 if log:: log_enabled!( Debug ) {
210217 log:: debug!( target: "corepc" , "error: {}: {:?}" , method, e) ;
211- } ,
212- Ok ( ref resp) =>
218+ }
219+ }
220+ Ok ( ref resp) => {
213221 if let Some ( ref e) = resp. error {
214222 if log:: log_enabled!( Debug ) {
215223 log:: debug!( target: "corepc" , "response error for {}: {:?}" , method, e) ;
@@ -219,7 +227,8 @@ fn log_response(method: &str, resp: &Result<jsonrpc::Response>) {
219227 serde_json:: value:: to_raw_value ( & serde_json:: value:: Value :: Null ) . unwrap ( ) ;
220228 let result = resp. result . as_ref ( ) . unwrap_or ( & def) ;
221229 log:: trace!( target: "corepc" , "response for {}: {}" , method, result) ;
222- } ,
230+ }
231+ }
223232 }
224233 }
225234}
@@ -262,3 +271,18 @@ pub enum TemplateRules {
262271 /// Taproot supported.
263272 Taproot ,
264273}
274+
275+ /// Arg for the `getblocktemplate` method. (v29+).
276+ #[ derive( Serialize , Deserialize , Debug , Clone , PartialEq , Eq , Default ) ]
277+ pub struct TemplateRequestV29 {
278+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
279+ pub mode : Option < String > ,
280+ #[ serde( default , skip_serializing_if = "Vec::is_empty" ) ]
281+ pub capabilities : Vec < String > ,
282+ #[ serde( default , skip_serializing_if = "Vec::is_empty" ) ]
283+ pub rules : Vec < String > ,
284+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
285+ pub longpollid : Option < String > ,
286+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
287+ pub data : Option < String > ,
288+ }
0 commit comments