X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=rust-lightning;a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fchannel.rs;h=bef69235b3e139b95d3a129b6eec1cbe7462b19f;hp=cfb5e8096e32d93680d4912c9c9e0f841f192f2a;hb=dde344a51d431ef013cb7ebb3df0c765dd9ef8be;hpb=27079e04d7b542058e48cafaf5c2e7114b3b8e15 diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index cfb5e809..bef69235 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -8,8 +8,7 @@ use bitcoin::consensus::encode; use bitcoin::hashes::{Hash, HashEngine}; use bitcoin::hashes::sha256::Hash as Sha256; -use bitcoin::hashes::hash160::Hash as Hash160; -use bitcoin::hash_types::{Txid, BlockHash}; +use bitcoin::hash_types::{Txid, BlockHash, WPubkeyHash}; use bitcoin::secp256k1::key::{PublicKey,SecretKey}; use bitcoin::secp256k1::{Secp256k1,Signature}; @@ -983,7 +982,7 @@ impl Channel { log_trace!(self, " ...including {} output with value {}", if local { "to_remote" } else { "to_local" }, value_to_b); txouts.push((TxOut { script_pubkey: Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0) - .push_slice(&Hash160::hash(&keys.b_payment_key.serialize())[..]) + .push_slice(&WPubkeyHash::hash(&keys.b_payment_key.serialize())[..]) .into_script(), value: value_to_b as u64 }, None)); @@ -1025,7 +1024,7 @@ impl Channel { #[inline] fn get_closing_scriptpubkey(&self) -> Script { - let our_channel_close_key_hash = Hash160::hash(&self.shutdown_pubkey.serialize()); + let our_channel_close_key_hash = WPubkeyHash::hash(&self.shutdown_pubkey.serialize()); Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0).push_slice(&our_channel_close_key_hash[..]).into_script() } @@ -4310,9 +4309,8 @@ mod tests { use bitcoin::secp256k1::{Secp256k1, Message, Signature, All}; use bitcoin::secp256k1::key::{SecretKey,PublicKey}; use bitcoin::hashes::sha256::Hash as Sha256; - use bitcoin::hashes::hash160::Hash as Hash160; use bitcoin::hashes::Hash; - use bitcoin::hash_types::Txid; + use bitcoin::hash_types::{Txid, WPubkeyHash}; use std::sync::Arc; use rand::{thread_rng,Rng}; @@ -4341,7 +4339,7 @@ mod tests { fn get_destination_script(&self) -> Script { let secp_ctx = Secp256k1::signing_only(); let channel_monitor_claim_key = SecretKey::from_slice(&hex::decode("0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()[..]).unwrap(); - let our_channel_monitor_claim_key_hash = Hash160::hash(&PublicKey::from_secret_key(&secp_ctx, &channel_monitor_claim_key).serialize()); + let our_channel_monitor_claim_key_hash = WPubkeyHash::hash(&PublicKey::from_secret_key(&secp_ctx, &channel_monitor_claim_key).serialize()); Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0).push_slice(&our_channel_monitor_claim_key_hash[..]).into_script() }