Skip to content

Commit

Permalink
addr: improve info
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jul 31, 2023
1 parent e7c7646 commit 4e64167
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions std/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ pub struct UtxoInfo {
pub outpoint: Outpoint,
pub value: Sats,
pub address: Address,
pub derivation: Terminal,
pub terminal: Terminal,
}

#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct AddrInfo {
pub derivation: Terminal,
pub addr: Address,
pub terminal: Terminal,
pub used: u32,
pub volume: Sats,
pub balance: Sats,
Expand All @@ -107,7 +108,8 @@ pub struct AddrInfo {
impl From<DerivedAddr> for AddrInfo {
fn from(derived: DerivedAddr) -> Self {
AddrInfo {
derivation: derived.terminal,
addr: derived.addr,
terminal: derived.terminal,
used: 0,
volume: Sats::ZERO,
balance: Sats::ZERO,
Expand Down Expand Up @@ -150,7 +152,7 @@ impl WalletCache {
txids.extend(r.iter().map(|utxo| utxo.outpoint.txid));
let max_known = cache.max_known.entry(*keychain).or_default();
*max_known = max(
r.iter().map(|utxo| utxo.derivation.index).max().unwrap_or_default(),
r.iter().map(|utxo| utxo.terminal.index).max().unwrap_or_default(),
*max_known,
);
if r.is_empty() {
Expand Down

0 comments on commit 4e64167

Please sign in to comment.