Skip to content

Commit cf50138

Browse files
committed
Add is_mine to Wallet
Takes a `&Script` as an input and returns `true` if we own it, `false` otherwise.
1 parent aec3d8e commit cf50138

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/wallet.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use bitcoin::blockdata::locktime::absolute::LockTime;
2525
use bitcoin::secp256k1::ecdh::SharedSecret;
2626
use bitcoin::secp256k1::ecdsa::{RecoverableSignature, Signature};
2727
use bitcoin::secp256k1::{PublicKey, Scalar, Secp256k1, SecretKey, Signing};
28-
use bitcoin::{ScriptBuf, Transaction, TxOut, Txid};
28+
use bitcoin::{Script, ScriptBuf, Transaction, TxOut, Txid};
2929

3030
use std::ops::Deref;
3131
use std::sync::{Arc, Condvar, Mutex};
@@ -163,6 +163,11 @@ where
163163
Ok(address_info.address)
164164
}
165165

166+
pub(crate) fn is_mine(&self, script: &Script) -> Result<bool, Error> {
167+
let is_mine = self.inner.lock().unwrap().is_mine(script)?;
168+
Ok(is_mine)
169+
}
170+
166171
pub(crate) fn get_balance(&self) -> Result<bdk::Balance, Error> {
167172
Ok(self.inner.lock().unwrap().get_balance()?)
168173
}

0 commit comments

Comments
 (0)