@@ -2,6 +2,7 @@ use std::{sync::{Arc}};
22
33use bitcoin:: { BlockHash , Block } ;
44use lightning_block_sync:: { rpc:: RpcClient , http:: { HttpEndpoint } , BlockSource , AsyncBlockSourceResult , BlockHeaderData } ;
5+ use serde_json:: json;
56use tokio:: sync:: Mutex ;
67
78use crate :: convert:: { CreateWalletResponse , BlockchainInfoResponse , NewAddressResponse , GetBalanceResponse , GenerateToAddressResponse } ;
@@ -48,7 +49,7 @@ impl BitcoindClient {
4849 let rpc_creditials =
4950 base64:: encode ( format ! ( "{}:{}" , rpc_user. clone( ) , rpc_password. clone( ) ) ) ;
5051 let mut bitcoind_rpc_client = RpcClient :: new ( & rpc_creditials, http_endpoint) ?;
51- let _dummy = bitcoind_rpc_client
52+ bitcoind_rpc_client
5253 . call_method :: < BlockchainInfoResponse > ( "getblockchaininfo" , & vec ! [ ] )
5354 . await
5455 . map_err ( |_| {
@@ -81,15 +82,15 @@ impl BitcoindClient {
8182
8283 pub async fn create_wallet ( & self ) -> CreateWalletResponse {
8384 let mut rpc = self . bitcoind_rpc_client . lock ( ) . await ;
84- let create_wallet_args = vec ! [ serde_json :: json!( "test-wallet" ) ] ;
85+ let create_wallet_args = vec ! [ json!( "test-wallet" ) ] ;
8586
8687 rpc. call_method :: < CreateWalletResponse > ( "createwallet" , & create_wallet_args) . await . unwrap ( )
8788 }
8889
8990 pub async fn get_new_address ( & self ) -> String {
9091 let mut rpc = self . bitcoind_rpc_client . lock ( ) . await ;
9192
92- let addr_args = vec ! [ serde_json :: json!( "LDK output address" ) ] ;
93+ let addr_args = vec ! [ json!( "LDK output address" ) ] ;
9394 let addr = rpc. call_method :: < NewAddressResponse > ( "getnewaddress" , & addr_args) . await . unwrap ( ) ;
9495 addr. 0 . to_string ( )
9596 }
@@ -103,16 +104,9 @@ impl BitcoindClient {
103104 pub async fn generate_to_address ( & self , block_num : u64 , address : & str ) -> GenerateToAddressResponse {
104105 let mut rpc = self . bitcoind_rpc_client . lock ( ) . await ;
105106
106- let generate_to_address_args = vec ! [ serde_json :: json!( block_num) , serde_json :: json!( address) ] ;
107+ let generate_to_address_args = vec ! [ json!( block_num) , json!( address) ] ;
107108
108109
109110 rpc. call_method :: < GenerateToAddressResponse > ( "generatetoaddress" , & generate_to_address_args) . await . unwrap ( )
110111 }
111- }
112-
113-
114-
115-
116-
117-
118-
112+ }
0 commit comments