diff --git a/src/contracts.rs b/src/contracts.rs index 2ebdef6d..28021406 100644 --- a/src/contracts.rs +++ b/src/contracts.rs @@ -51,7 +51,7 @@ pub trait SwapCoin { fn verify_contract_tx_receiver_sig(&self, sig: &Signature) -> bool; fn verify_contract_tx_sender_sig(&self, sig: &Signature) -> bool; fn apply_privkey(&mut self, privkey: SecretKey) -> Result<(), Error>; - fn is_known(&self) -> bool; + fn is_hash_preimage_known(&self) -> bool; } pub fn calculate_maker_pubkey_from_nonce( @@ -505,8 +505,8 @@ impl SwapCoin for IncomingSwapCoin { Ok(()) } - fn is_known(&self) -> bool { - self.contract_privkey_is_known() + fn is_hash_preimage_known(&self) -> bool { + self.hash_preimage.is_some() } } @@ -555,8 +555,8 @@ impl SwapCoin for OutgoingSwapCoin { } } - fn is_known(&self) -> bool { - self.contract_privkey_is_known() + fn is_hash_preimage_known(&self) -> bool { + self.hash_preimage.is_some() } } @@ -647,7 +647,7 @@ impl SwapCoin for WatchOnlySwapCoin { } } - fn is_known(&self) -> bool { + fn is_hash_preimage_known(&self) -> bool { false } } diff --git a/src/main.rs b/src/main.rs index 5dd810a5..66944a24 100644 --- a/src/main.rs +++ b/src/main.rs @@ -208,7 +208,7 @@ fn display_wallet_balance(wallet_file_name: &PathBuf, long_form: Option) { if long_form { &"" } else { &txid[58..64] }, utxo.vout, contract_type, - if swapcoin.is_known() { "known" } else { "unknown" }, + if swapcoin.is_hash_preimage_known() { "known" } else { "unknown" }, read_locktime_from_contract(&swapcoin.get_contract_redeemscript()) .expect("unable to read locktime from contract"), utxo.confirmations, diff --git a/src/wallet_sync.rs b/src/wallet_sync.rs index 5e878264..f0524e0c 100644 --- a/src/wallet_sync.rs +++ b/src/wallet_sync.rs @@ -153,10 +153,6 @@ impl IncomingSwapCoin { hash_preimage: None, } } - - pub fn contract_privkey_is_known(&self) -> bool { - self.other_privkey.is_some() || self.hash_preimage.is_some() - } } impl OutgoingSwapCoin { @@ -188,10 +184,6 @@ impl OutgoingSwapCoin { hash_preimage: None, } } - - pub fn contract_privkey_is_known(&self) -> bool { - self.hash_preimage.is_some() - } } pub trait WalletSwapCoin { @@ -330,7 +322,7 @@ impl Wallet { Address::p2wsh(script, NETWORK), contract_tx.input[0].previous_output.txid, contract_tx.input[0].previous_output.vout, - if coin.is_known() { + if coin.is_hash_preimage_known() { " known" } else { "unknown" @@ -811,7 +803,7 @@ impl Wallet { ), >::new(); let get_hashvalue = |s: &dyn SwapCoin| { - if s.is_known() { + if s.is_hash_preimage_known() { return None; } let swapcoin_hashvalue = read_hashvalue_from_contract(&s.get_contract_redeemscript())