@@ -68,6 +68,8 @@ pub(crate) type Responder<T> = oneshot::Sender<T>;
68
68
pub struct ServerInfo {
69
69
pub chain : ExtendedNetwork ,
70
70
pub tip : ChainAnchor ,
71
+ pub blocks_height : u32 ,
72
+ pub headers_height : u32 ,
71
73
}
72
74
73
75
#[ derive( Debug , Clone , Serialize , Deserialize ) ]
@@ -401,6 +403,7 @@ pub struct RegisterParams {
401
403
pub struct RpcServerImpl {
402
404
wallet_manager : WalletManager ,
403
405
store : AsyncChainState ,
406
+ rpc : BitcoinRpc ,
404
407
client : reqwest:: Client ,
405
408
}
406
409
@@ -647,9 +650,11 @@ impl WalletManager {
647
650
648
651
impl RpcServerImpl {
649
652
pub fn new ( store : AsyncChainState , wallet_manager : WalletManager ) -> Self {
653
+ let rpc = wallet_manager. rpc . clone ( ) ;
650
654
RpcServerImpl {
651
655
wallet_manager,
652
656
store,
657
+ rpc,
653
658
client : reqwest:: Client :: new ( ) ,
654
659
}
655
660
}
@@ -729,7 +734,22 @@ impl RpcServer for RpcServerImpl {
729
734
. get_tip ( )
730
735
. await
731
736
. map_err ( |error| ErrorObjectOwned :: owned ( -1 , error. to_string ( ) , None :: < String > ) ) ?;
732
- Ok ( ServerInfo { chain, tip } )
737
+ #[ derive( Deserialize ) ]
738
+ struct Info {
739
+ blocks : u32 ,
740
+ headers : u32 ,
741
+ }
742
+ let info: Info = self
743
+ . rpc
744
+ . send_json ( & self . client , & self . rpc . get_blockchain_info ( ) )
745
+ . await
746
+ . map_err ( |error| ErrorObjectOwned :: owned ( -1 , error. to_string ( ) , None :: < String > ) ) ?;
747
+ Ok ( ServerInfo {
748
+ chain,
749
+ tip,
750
+ blocks_height : info. blocks ,
751
+ headers_height : info. headers ,
752
+ } )
733
753
}
734
754
735
755
async fn get_space (
0 commit comments