35
35
// A BDK blockchain used for wallet sync.
36
36
blockchain : EsploraBlockchain ,
37
37
// A BDK on-chain wallet.
38
- wallet : Mutex < bdk:: Wallet < D > > ,
38
+ inner : Mutex < bdk:: Wallet < D > > ,
39
39
// A cache storing the most recently retrieved fee rate estimations.
40
40
fee_rate_cache : Mutex < HashMap < ConfirmationTarget , FeeRate > > ,
41
41
tokio_runtime : RwLock < Option < Arc < tokio:: runtime:: Runtime > > > ,
@@ -49,15 +49,15 @@ where
49
49
pub ( crate ) fn new (
50
50
blockchain : EsploraBlockchain , wallet : bdk:: Wallet < D > , logger : Arc < FilesystemLogger > ,
51
51
) -> Self {
52
- let wallet = Mutex :: new ( wallet) ;
52
+ let inner = Mutex :: new ( wallet) ;
53
53
let fee_rate_cache = Mutex :: new ( HashMap :: new ( ) ) ;
54
54
let tokio_runtime = RwLock :: new ( None ) ;
55
- Self { blockchain, wallet , fee_rate_cache, tokio_runtime, logger }
55
+ Self { blockchain, inner , fee_rate_cache, tokio_runtime, logger }
56
56
}
57
57
58
58
pub ( crate ) async fn sync ( & self ) -> Result < ( ) , Error > {
59
59
let sync_options = SyncOptions { progress : None } ;
60
- match self . wallet . lock ( ) . unwrap ( ) . sync ( & self . blockchain , sync_options) . await {
60
+ match self . inner . lock ( ) . unwrap ( ) . sync ( & self . blockchain , sync_options) . await {
61
61
Ok ( ( ) ) => Ok ( ( ) ) ,
62
62
Err ( e) => {
63
63
log_error ! ( self . logger, "Wallet sync error: {}" , e) ;
79
79
) -> Result < Transaction , Error > {
80
80
let fee_rate = self . estimate_fee_rate ( confirmation_target) ;
81
81
82
- let locked_wallet = self . wallet . lock ( ) . unwrap ( ) ;
82
+ let locked_wallet = self . inner . lock ( ) . unwrap ( ) ;
83
83
let mut tx_builder = locked_wallet. build_tx ( ) ;
84
84
85
85
tx_builder. add_recipient ( output_script. clone ( ) , value_sats) . fee_rate ( fee_rate) . enable_rbf ( ) ;
@@ -112,13 +112,13 @@ where
112
112
}
113
113
114
114
pub ( crate ) fn get_new_address ( & self ) -> Result < bitcoin:: Address , Error > {
115
- let address_info = self . wallet . lock ( ) . unwrap ( ) . get_address ( AddressIndex :: New ) ?;
115
+ let address_info = self . inner . lock ( ) . unwrap ( ) . get_address ( AddressIndex :: New ) ?;
116
116
Ok ( address_info. address )
117
117
}
118
118
119
119
#[ cfg( any( test) ) ]
120
120
pub ( crate ) fn get_balance ( & self ) -> Result < bdk:: Balance , Error > {
121
- Ok ( self . wallet . lock ( ) . unwrap ( ) . get_balance ( ) ?)
121
+ Ok ( self . inner . lock ( ) . unwrap ( ) . get_balance ( ) ?)
122
122
}
123
123
124
124
fn estimate_fee_rate ( & self , confirmation_target : ConfirmationTarget ) -> FeeRate {
0 commit comments