Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nakamoto-wallet: --addresses parameter is currently ignored #153

Open
theStack opened this issue Feb 15, 2024 · 1 comment
Open

nakamoto-wallet: --addresses parameter is currently ignored #153

theStack opened this issue Feb 15, 2024 · 1 comment

Comments

@theStack
Copy link
Contributor

nakamoto-wallet specifies a parameter --addresses:

/// watch the following addresses
#[argh(option)]
pub addresses: Vec<Address>,

But the value of that parameter is never read anywhere. In the start of wallet loop, the addresses are either fetched from the database, or if that is empty, from the hardware device:

let addresses = self.db.addresses()?;
if addresses.is_empty() {
log::info!("No addresses found, requesting from hardware device..");
match self.hw.request_addresses(0..16, hw::AddressFormat::P2WPKH) {
Ok(addrs) => {
for (ix, addr) in addrs {
self.db.add_address(&addr, ix, None)?;
self.watch.insert(addr);
}
}
Err(err) => {
log::warn!("Failed to request addresses from hardware device: {err}");
}
}
} else {
for addr in addresses {
self.watch.insert(addr.address);
}
}

Happy to open a PR if someone can point me into the right direction how that parameter was intended. If it's specified, should only those addresses be watched or do we still want to load the ones from the database?

@vincenzopalazzo
Copy link
Collaborator

Happy to open a PR if someone can point me into the right direction how that parameter was intended. If it's specified, should only those addresses be watched or do we still want to load the ones from the database?

Right, so we had to put the address inside the db and then nakamoto will be able to load them. So I think we should insert the address passed by --addresses inside the db and then leave the code query the databases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants