Skip to content

Commit

Permalink
Merge pull request #514 from gregdhill/chore/light-dump
Browse files Browse the repository at this point in the history
chore: implement dump_private_key for light client
  • Loading branch information
gregdhill authored Aug 22, 2023
2 parents 82e085a + 44d8c70 commit 8430fc1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bitcoin/src/light/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,14 @@ impl BitcoinCoreApi for BitcoinLight {
Ok(self.private_key.public_key(&self.secp_ctx))
}

fn dump_private_key(&self, _: &Address) -> Result<PrivateKey, BitcoinError> {
Err(Error::InvalidAddress.into())
fn dump_private_key(&self, address: &Address) -> Result<PrivateKey, BitcoinError> {
self.wallet
.key_store
.read()
.map_err(Into::<Error>::into)?
.get(address)
.ok_or(Error::NoPrivateKey.into())
.cloned()
}

fn import_private_key(&self, _private_key: &PrivateKey, _is_derivation_key: bool) -> Result<(), BitcoinError> {
Expand Down

0 comments on commit 8430fc1

Please sign in to comment.