Skip to content

Commit ea03f40

Browse files
committed
Use new from* conversion methods on Hash types
1 parent c5c48e9 commit ea03f40

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

lightning-block-sync/src/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl Blockchain {
5050
input: vec![],
5151
output: vec![]
5252
};
53-
let merkle_root = TxMerkleNode::from_raw_hash(coinbase.txid().as_hash()).unwrap();
53+
let merkle_root = TxMerkleNode::from_raw_hash(coinbase.txid().to_raw_hash());
5454
self.blocks.push(Block {
5555
header: Header {
5656
version: Version::NO_SOFT_FORK_SIGNALLING,

lightning/src/ln/msgs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,7 +2874,7 @@ mod tests {
28742874
next_remote_commitment_number: 4,
28752875
your_last_per_commitment_secret: [9;32],
28762876
my_current_per_commitment_point: public_key,
2877-
next_funding_txid: Some(Txid::from_hash(bitcoin::hashes::Hash::from_slice(&[
2877+
next_funding_txid: Some(Txid::from_raw_hash(bitcoin::hashes::Hash::from_slice(&[
28782878
48, 167, 250, 69, 152, 48, 103, 172, 164, 99, 59, 19, 23, 11, 92, 84, 15, 80, 4, 12, 98, 82, 75, 31, 201, 11, 91, 23, 98, 23, 53, 124,
28792879
]).unwrap())),
28802880
};
@@ -3882,7 +3882,7 @@ mod tests {
38823882
}.encode(), hex::decode("0000000001206fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000").unwrap());
38833883
assert_eq!(msgs::Init {
38843884
features: InitFeatures::from_le_bytes(vec![]),
3885-
networks: Some(vec![ChainHash::from(&[1; 32][..]), ChainHash::from(&[2; 32][..])]),
3885+
networks: Some(vec![ChainHash::from(&[1; 32]), ChainHash::from(&[2; 32])]),
38863886
remote_network_address: None,
38873887
}.encode(), hex::decode("00000000014001010101010101010101010101010101010101010101010101010101010101010202020202020202020202020202020202020202020202020202020202020202").unwrap());
38883888
let init_msg = msgs::Init { features: InitFeatures::from_le_bytes(vec![]),

lightning/src/ln/peer_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2676,7 +2676,7 @@ mod tests {
26762676
for i in 0..peer_count {
26772677
let node_secret = SecretKey::from_slice(&[42 + i as u8; 32]).unwrap();
26782678
let features = InitFeatures::from_le_bytes(vec![0u8; 33]);
2679-
let network = ChainHash::from(&[i as u8; 32][..]);
2679+
let network = ChainHash::from(&[i as u8; 32]);
26802680
cfgs.push(
26812681
PeerManagerCfg{
26822682
chan_handler: test_utils::TestChannelMessageHandler::new(network),

lightning/src/util/ser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ impl Writeable for ChainHash {
11401140
impl Readable for ChainHash {
11411141
fn read<R: Read>(r: &mut R) -> Result<Self, DecodeError> {
11421142
let buf: [u8; 32] = Readable::read(r)?;
1143-
Ok(ChainHash::from(&buf[..]))
1143+
Ok(ChainHash::from(buf))
11441144
}
11451145
}
11461146

0 commit comments

Comments
 (0)