gui: Daemon trait => add receive and change indexes to GetInfoResult
This commit is contained in:
parent
86313f5282
commit
f7ed341d28
@ -754,6 +754,8 @@ mod tests {
|
||||
"block_height": 1000,
|
||||
"sync": 1.0,
|
||||
"descriptors": { "main": LianaDescriptor::from_str(DESC).unwrap() },
|
||||
"receive_index": 4,
|
||||
"change_index": 3,
|
||||
"timestamp": 1000,
|
||||
})),
|
||||
),
|
||||
|
||||
@ -105,6 +105,8 @@ pub struct Wallet {
|
||||
pub name: String,
|
||||
#[serde(deserialize_with = "deser_fromstr")]
|
||||
pub descriptor: LianaDescriptor,
|
||||
pub deposit_derivation_index: u32,
|
||||
pub change_derivation_index: u32,
|
||||
pub recovery_paths: Vec<RecoveryPath>,
|
||||
pub biggest_remaining_sequence: Option<u32>,
|
||||
pub smallest_remaining_sequence: Option<u32>,
|
||||
|
||||
@ -594,6 +594,8 @@ impl Daemon for BackendWalletClient {
|
||||
timestamp: wallet.created_at as u32,
|
||||
// We can ignore this field for remote backend as the wallet should remain synced.
|
||||
last_poll_timestamp: None,
|
||||
receive_index: wallet.deposit_derivation_index,
|
||||
change_index: wallet.change_derivation_index,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@ -314,6 +314,8 @@ impl DaemonControl {
|
||||
let mut db_conn = self.db.connection();
|
||||
let block_height = db_conn.chain_tip().map(|tip| tip.height).unwrap_or(0);
|
||||
let wallet = db_conn.wallet();
|
||||
let receive_index: u32 = db_conn.receive_index().into();
|
||||
let change_index: u32 = db_conn.change_index().into();
|
||||
let rescan_progress = wallet
|
||||
.rescan_timestamp
|
||||
.map(|_| self.bitcoin.rescan_progress().unwrap_or(1.0));
|
||||
@ -328,6 +330,8 @@ impl DaemonControl {
|
||||
rescan_progress,
|
||||
timestamp: wallet.timestamp,
|
||||
last_poll_timestamp: wallet.last_poll_timestamp,
|
||||
receive_index,
|
||||
change_index,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1168,6 +1172,10 @@ pub struct GetInfoResult {
|
||||
pub timestamp: u32,
|
||||
/// Timestamp of last poll, if any.
|
||||
pub last_poll_timestamp: Option<u32>,
|
||||
/// Last index used to generate a receive address
|
||||
pub receive_index: u32,
|
||||
/// Last index used to generate a change address
|
||||
pub change_index: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user