Skip to content

Commit

Permalink
chore: implement dump_private_key for light client
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory Hill <[email protected]>
  • Loading branch information
gregdhill committed Aug 21, 2023
1 parent 82e085a commit 44d8c70
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 44d8c70

Please sign in to comment.