@@ -15,6 +15,7 @@ pub mod v25;
15
15
pub mod v26;
16
16
pub mod v27;
17
17
pub mod v28;
18
+ pub mod v29;
18
19
19
20
use std:: fs:: File ;
20
21
use std:: io:: { BufRead , BufReader } ;
@@ -177,15 +178,21 @@ where
177
178
178
179
/// Shorthand for `serde_json::Value::Null`.
179
180
#[ 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
+ }
181
184
182
185
/// Shorthand for an empty `serde_json::Value` array.
183
186
#[ 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
+ }
185
190
186
191
/// Shorthand for an empty `serde_json` object.
187
192
#[ 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
+ }
189
196
190
197
/// Convert a possible-null result into an `Option`.
191
198
#[ 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>) {
205
212
206
213
if log:: log_enabled!( Warn ) || log:: log_enabled!( Debug ) || log:: log_enabled!( Trace ) {
207
214
match resp {
208
- Err ( ref e) =>
215
+ Err ( ref e) => {
209
216
if log:: log_enabled!( Debug ) {
210
217
log:: debug!( target: "corepc" , "error: {}: {:?}" , method, e) ;
211
- } ,
212
- Ok ( ref resp) =>
218
+ }
219
+ }
220
+ Ok ( ref resp) => {
213
221
if let Some ( ref e) = resp. error {
214
222
if log:: log_enabled!( Debug ) {
215
223
log:: debug!( target: "corepc" , "response error for {}: {:?}" , method, e) ;
@@ -219,7 +227,8 @@ fn log_response(method: &str, resp: &Result<jsonrpc::Response>) {
219
227
serde_json:: value:: to_raw_value ( & serde_json:: value:: Value :: Null ) . unwrap ( ) ;
220
228
let result = resp. result . as_ref ( ) . unwrap_or ( & def) ;
221
229
log:: trace!( target: "corepc" , "response for {}: {}" , method, result) ;
222
- } ,
230
+ }
231
+ }
223
232
}
224
233
}
225
234
}
@@ -262,3 +271,18 @@ pub enum TemplateRules {
262
271
/// Taproot supported.
263
272
Taproot ,
264
273
}
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