Skip to content

migration to rust-bitcoin 0.17 #318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ max_level_info = []
max_level_debug = []

[dependencies]
bitcoin = "0.16"
bitcoin = "0.17"
bitcoin_hashes = "0.3"
rand = "0.4"
secp256k1 = "0.12"

[dev-dependencies.bitcoin]
version = "0.16"
version = "0.17"
features = ["bitcoinconsensus"]

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ libfuzzer_fuzz = ["libfuzzer-sys"]
[dependencies]
afl = { version = "0.4", optional = true }
lightning = { path = "..", features = ["fuzztarget"] }
bitcoin = { version = "0.16", features = ["fuzztarget"] }
bitcoin_hashes = { version = "0.2", features=["fuzztarget"] }
bitcoin = { version = "0.17", features = ["fuzztarget"] }
bitcoin_hashes = { version = "0.3", features=["fuzztarget"] }
hex = "0.3"
honggfuzz = { version = "0.5", optional = true }
secp256k1 = { version = "0.12", features=["fuzztarget"] }
Expand Down
3 changes: 2 additions & 1 deletion fuzz/fuzz_targets/chanmon_deser_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.

extern crate bitcoin;
extern crate bitcoin_hashes;
extern crate lightning;

use bitcoin::util::hash::Sha256dHash;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;

use lightning::ln::channelmonitor;
use lightning::util::reset_rng_state;
Expand Down
3 changes: 2 additions & 1 deletion fuzz/fuzz_targets/full_stack_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ use bitcoin::blockdata::script::{Builder, Script};
use bitcoin::blockdata::opcodes;
use bitcoin::consensus::encode::deserialize;
use bitcoin::network::constants::Network;
use bitcoin::util::hash::{BitcoinHash, Sha256dHash};
use bitcoin::util::hash::BitcoinHash;

use bitcoin_hashes::Hash as TraitImport;
use bitcoin_hashes::HashEngine as TraitImportEngine;
use bitcoin_hashes::sha256::Hash as Sha256;
use bitcoin_hashes::hash160::Hash as Hash160;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;

use lightning::chain::chaininterface::{BroadcasterInterface,ConfirmationTarget,ChainListener,FeeEstimator,ChainWatchInterfaceUtil};
use lightning::chain::transaction::OutPoint;
Expand Down
3 changes: 2 additions & 1 deletion fuzz/fuzz_targets/router_target.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
extern crate bitcoin;
extern crate bitcoin_hashes;
extern crate lightning;
extern crate secp256k1;

use bitcoin::util::hash::Sha256dHash;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;
use bitcoin::blockdata::script::{Script, Builder};

use lightning::chain::chaininterface::{ChainError,ChainWatchInterface, ChainListener};
Expand Down
3 changes: 2 additions & 1 deletion src/chain/chaininterface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use bitcoin::blockdata::block::{Block, BlockHeader};
use bitcoin::blockdata::transaction::Transaction;
use bitcoin::blockdata::script::Script;
use bitcoin::blockdata::constants::genesis_block;
use bitcoin::util::hash::{BitcoinHash, Sha256dHash};
use bitcoin::util::hash::BitcoinHash;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;
use bitcoin::network::constants::Network;

use util::logger::Logger;
Expand Down
28 changes: 14 additions & 14 deletions src/chain/keysinterface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,23 @@ impl KeysManager {
let secp_ctx = Secp256k1::signing_only();
match ExtendedPrivKey::new_master(network.clone(), seed) {
Ok(master_key) => {
let node_secret = master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(0)).expect("Your RNG is busted").secret_key;
let destination_script = match master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(1)) {
let node_secret = master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(0).unwrap()).expect("Your RNG is busted").private_key.key;
let destination_script = match master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(1).unwrap()) {
Ok(destination_key) => {
let pubkey_hash160 = Hash160::hash(&ExtendedPubKey::from_private(&secp_ctx, &destination_key).public_key.serialize()[..]);
let pubkey_hash160 = Hash160::hash(&ExtendedPubKey::from_private(&secp_ctx, &destination_key).public_key.key.serialize()[..]);
Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0)
.push_slice(&pubkey_hash160.into_inner())
.into_script()
},
Err(_) => panic!("Your RNG is busted"),
};
let shutdown_pubkey = match master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(2)) {
Ok(shutdown_key) => ExtendedPubKey::from_private(&secp_ctx, &shutdown_key).public_key,
let shutdown_pubkey = match master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(2).unwrap()) {
Ok(shutdown_key) => ExtendedPubKey::from_private(&secp_ctx, &shutdown_key).public_key.key,
Err(_) => panic!("Your RNG is busted"),
};
let channel_master_key = master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(3)).expect("Your RNG is busted");
let session_master_key = master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(4)).expect("Your RNG is busted");
let channel_id_master_key = master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(5)).expect("Your RNG is busted");
let channel_master_key = master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(3).unwrap()).expect("Your RNG is busted");
let session_master_key = master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(4).unwrap()).expect("Your RNG is busted");
let channel_id_master_key = master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx(5).unwrap()).expect("Your RNG is busted");
KeysManager {
secp_ctx,
node_secret,
Expand Down Expand Up @@ -207,8 +207,8 @@ impl KeysInterface for KeysManager {
sha.input(&byte_utils::be64_to_array(now.as_secs()));

let child_ix = self.channel_child_index.fetch_add(1, Ordering::AcqRel);
let child_privkey = self.channel_master_key.ckd_priv(&self.secp_ctx, ChildNumber::from_hardened_idx(child_ix as u32)).expect("Your RNG is busted");
sha.input(&child_privkey.secret_key[..]);
let child_privkey = self.channel_master_key.ckd_priv(&self.secp_ctx, ChildNumber::from_hardened_idx(child_ix as u32).expect("key space exhausted")).expect("Your RNG is busted");
sha.input(&child_privkey.private_key.key[..]);

seed = Sha256::from_engine(sha).into_inner();

Expand Down Expand Up @@ -251,8 +251,8 @@ impl KeysInterface for KeysManager {
sha.input(&byte_utils::be64_to_array(now.as_secs()));

let child_ix = self.session_child_index.fetch_add(1, Ordering::AcqRel);
let child_privkey = self.session_master_key.ckd_priv(&self.secp_ctx, ChildNumber::from_hardened_idx(child_ix as u32)).expect("Your RNG is busted");
sha.input(&child_privkey.secret_key[..]);
let child_privkey = self.session_master_key.ckd_priv(&self.secp_ctx, ChildNumber::from_hardened_idx(child_ix as u32).expect("key space exhausted")).expect("Your RNG is busted");
sha.input(&child_privkey.private_key.key[..]);
SecretKey::from_slice(&Sha256::from_engine(sha).into_inner()).expect("Your RNG is busted")
}

Expand All @@ -264,8 +264,8 @@ impl KeysInterface for KeysManager {
sha.input(&byte_utils::be64_to_array(now.as_secs()));

let child_ix = self.channel_id_child_index.fetch_add(1, Ordering::AcqRel);
let child_privkey = self.channel_id_master_key.ckd_priv(&self.secp_ctx, ChildNumber::from_hardened_idx(child_ix as u32)).expect("Your RNG is busted");
sha.input(&child_privkey.secret_key[..]);
let child_privkey = self.channel_id_master_key.ckd_priv(&self.secp_ctx, ChildNumber::from_hardened_idx(child_ix as u32).expect("key space exhausted")).expect("Your RNG is busted");
sha.input(&child_privkey.private_key.key[..]);

(Sha256::from_engine(sha).into_inner())
}
Expand Down
2 changes: 1 addition & 1 deletion src/chain/transaction.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Contains simple structs describing parts of transactions on the chain.

use bitcoin::util::hash::Sha256dHash;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;
use bitcoin::blockdata::transaction::OutPoint as BitcoinOutPoint;

/// A reference to a transaction output.
Expand Down
2 changes: 1 addition & 1 deletion src/ln/chan_utils.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use bitcoin::blockdata::script::{Script,Builder};
use bitcoin::blockdata::opcodes;
use bitcoin::blockdata::transaction::{TxIn,TxOut,OutPoint,Transaction};
use bitcoin::util::hash::{Sha256dHash};

use bitcoin_hashes::{Hash, HashEngine};
use bitcoin_hashes::sha256::Hash as Sha256;
use bitcoin_hashes::ripemd160::Hash as Ripemd160;
use bitcoin_hashes::hash160::Hash as Hash160;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;

use ln::channelmanager::PaymentHash;

Expand Down
11 changes: 7 additions & 4 deletions src/ln/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ use bitcoin::blockdata::block::BlockHeader;
use bitcoin::blockdata::script::{Script,Builder};
use bitcoin::blockdata::transaction::{TxIn, TxOut, Transaction, SigHashType};
use bitcoin::blockdata::opcodes;
use bitcoin::util::hash::{BitcoinHash, Sha256dHash};
use bitcoin::util::hash::BitcoinHash;
use bitcoin::util::bip143;
use bitcoin::consensus::encode::{self, Encodable, Decodable};

use bitcoin_hashes::{Hash, HashEngine};
use bitcoin_hashes::sha256::Hash as Sha256;
use bitcoin_hashes::hash160::Hash as Hash160;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;

use secp256k1::key::{PublicKey,SecretKey};
use secp256k1::{Secp256k1,Signature};
Expand Down Expand Up @@ -3143,7 +3144,7 @@ impl Channel {
excess_data: Vec::new(),
};

let msghash = hash_to_message!(&Sha256dHash::from_data(&msg.encode()[..])[..]);
let msghash = hash_to_message!(&Sha256dHash::hash(&msg.encode()[..])[..]);
let sig = self.secp_ctx.sign(&msghash, &self.local_keys.funding_key);

Ok((msg, sig))
Expand Down Expand Up @@ -3954,12 +3955,12 @@ impl<R : ::std::io::Read> ReadableArgs<R, Arc<Logger>> for Channel {

#[cfg(test)]
mod tests {
use bitcoin::util::hash::{Sha256dHash, Hash160};
use bitcoin::util::bip143;
use bitcoin::consensus::encode::serialize;
use bitcoin::blockdata::script::{Script, Builder};
use bitcoin::blockdata::transaction::Transaction;
use bitcoin::blockdata::opcodes;
use bitcoin_hashes::hex::FromHex;
use hex;
use ln::channelmanager::{HTLCSource, PaymentPreimage, PaymentHash};
use ln::channel::{Channel,ChannelKeys,InboundHTLCOutput,OutboundHTLCOutput,InboundHTLCState,OutboundHTLCState,HTLCOutputInCommitment,TxCreationKeys};
Expand All @@ -3974,6 +3975,8 @@ mod tests {
use secp256k1::{Secp256k1,Message,Signature};
use secp256k1::key::{SecretKey,PublicKey};
use bitcoin_hashes::sha256::Hash as Sha256;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;
use bitcoin_hashes::hash160::Hash as Hash160;
use bitcoin_hashes::Hash;
use std::sync::Arc;

Expand All @@ -4000,7 +4003,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::from_data(&PublicKey::from_secret_key(&secp_ctx, &channel_monitor_claim_key).serialize());
let our_channel_monitor_claim_key_hash = Hash160::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()
}

Expand Down
9 changes: 5 additions & 4 deletions src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ use bitcoin::blockdata::block::BlockHeader;
use bitcoin::blockdata::transaction::Transaction;
use bitcoin::blockdata::constants::genesis_block;
use bitcoin::network::constants::Network;
use bitcoin::util::hash::{BitcoinHash, Sha256dHash};
use bitcoin::util::hash::BitcoinHash;

use bitcoin_hashes::{Hash, HashEngine};
use bitcoin_hashes::hmac::{Hmac, HmacEngine};
use bitcoin_hashes::sha256::Hash as Sha256;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;
use bitcoin_hashes::cmp::fixed_time_eq;

use secp256k1::key::{SecretKey,PublicKey};
Expand Down Expand Up @@ -964,7 +965,7 @@ impl ChannelManager {
excess_data: Vec::new(),
};

let msg_hash = Sha256dHash::from_data(&unsigned.encode()[..]);
let msg_hash = Sha256dHash::hash(&unsigned.encode()[..]);
let sig = self.secp_ctx.sign(&hash_to_message!(&msg_hash[..]), &self.our_network_key);

Ok(msgs::ChannelUpdate {
Expand Down Expand Up @@ -1158,7 +1159,7 @@ impl ChannelManager {
Ok(res) => res,
Err(_) => return None, // Only in case of state precondition violations eg channel is closing
};
let msghash = hash_to_message!(&Sha256dHash::from_data(&announcement.encode()[..])[..]);
let msghash = hash_to_message!(&Sha256dHash::hash(&announcement.encode()[..])[..]);
let our_node_sig = self.secp_ctx.sign(&msghash, &self.our_network_key);

Some(msgs::AnnouncementSignatures {
Expand Down Expand Up @@ -2182,7 +2183,7 @@ impl ChannelManager {
try_chan_entry!(self, chan.get_mut().get_channel_announcement(our_node_id.clone(), self.genesis_hash.clone()), channel_state, chan);

let were_node_one = announcement.node_id_1 == our_node_id;
let msghash = hash_to_message!(&Sha256dHash::from_data(&announcement.encode()[..])[..]);
let msghash = hash_to_message!(&Sha256dHash::hash(&announcement.encode()[..])[..]);
if self.secp_ctx.verify(&msghash, &msg.node_signature, if were_node_one { &announcement.node_id_2 } else { &announcement.node_id_1 }).is_err() ||
self.secp_ctx.verify(&msghash, &msg.bitcoin_signature, if were_node_one { &announcement.bitcoin_key_2 } else { &announcement.bitcoin_key_1 }).is_err() {
try_chan_entry!(self, Err(ChannelError::Close("Bad announcement_signatures node_signature")), channel_state, chan);
Expand Down
7 changes: 4 additions & 3 deletions src/ln/channelmonitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ use bitcoin::blockdata::transaction::OutPoint as BitcoinOutPoint;
use bitcoin::blockdata::script::{Script, Builder};
use bitcoin::blockdata::opcodes;
use bitcoin::consensus::encode::{self, Decodable, Encodable};
use bitcoin::util::hash::{BitcoinHash,Sha256dHash};
use bitcoin::util::hash::BitcoinHash;
use bitcoin::util::bip143;

use bitcoin_hashes::Hash;
use bitcoin_hashes::sha256::Hash as Sha256;
use bitcoin_hashes::hash160::Hash as Hash160;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;

use secp256k1::{Secp256k1,Signature};
use secp256k1::key::{SecretKey,PublicKey};
Expand Down Expand Up @@ -1179,7 +1180,7 @@ impl ChannelMonitor {
// on-chain claims, so we can do that at the same time.
macro_rules! check_htlc_fails {
($txid: expr, $commitment_tx: expr) => {
if let Some(ref outpoints) = self.remote_claimable_outpoints.get(&$txid) {
if let Some(ref outpoints) = self.remote_claimable_outpoints.get($txid) {
for &(ref htlc, ref source_option) in outpoints.iter() {
if let &Some(ref source) = source_option {
log_trace!(self, "Failing HTLC with payment_hash {} from {} remote commitment tx due to broadcast of revoked remote commitment transaction", log_bytes!(htlc.payment_hash.0), $commitment_tx);
Expand Down Expand Up @@ -1243,7 +1244,7 @@ impl ChannelMonitor {
// on-chain claims, so we can do that at the same time.
macro_rules! check_htlc_fails {
($txid: expr, $commitment_tx: expr, $id: tt) => {
if let Some(ref latest_outpoints) = self.remote_claimable_outpoints.get(&$txid) {
if let Some(ref latest_outpoints) = self.remote_claimable_outpoints.get($txid) {
$id: for &(ref htlc, ref source_option) in latest_outpoints.iter() {
if let &Some(ref source) = source_option {
// Check if the HTLC is present in the commitment transaction that was
Expand Down
19 changes: 10 additions & 9 deletions src/ln/functional_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ use util::ser::{Writeable, ReadableArgs};
use util::config::UserConfig;
use util::rng;

use bitcoin::util::hash::{BitcoinHash, Sha256dHash};
use bitcoin::util::hash::BitcoinHash;
use bitcoin_hashes::sha256d::Hash as Sha256dHash;
use bitcoin::util::bip143;
use bitcoin::util::address::Address;
use bitcoin::util::bip32::{ChildNumber, ExtendedPubKey, ExtendedPrivKey};
Expand Down Expand Up @@ -2486,7 +2487,7 @@ fn test_force_close_fail_back() {
// Now check that if we add the preimage to ChannelMonitor it broadcasts our HTLC-Success..
{
let mut monitors = nodes[2].chan_monitor.simple_monitor.monitors.lock().unwrap();
monitors.get_mut(&OutPoint::new(Sha256dHash::from(&payment_event.commitment_msg.channel_id[..]), 0)).unwrap()
monitors.get_mut(&OutPoint::new(Sha256dHash::from_slice(&payment_event.commitment_msg.channel_id[..]).unwrap(), 0)).unwrap()
.provide_payment_preimage(&our_payment_hash, &our_payment_preimage);
}
nodes[2].chain_monitor.block_connected_checked(&header, 1, &[&tx], &[1]);
Expand Down Expand Up @@ -3018,7 +3019,7 @@ fn test_invalid_channel_announcement() {

macro_rules! sign_msg {
($unsigned_msg: expr) => {
let msghash = Message::from_slice(&Sha256dHash::from_data(&$unsigned_msg.encode()[..])[..]).unwrap();
let msghash = Message::from_slice(&Sha256dHash::hash(&$unsigned_msg.encode()[..])[..]).unwrap();
let as_bitcoin_sig = secp_ctx.sign(&msghash, &as_chan.get_local_keys().funding_key);
let bs_bitcoin_sig = secp_ctx.sign(&msghash, &bs_chan.get_local_keys().funding_key);
let as_node_sig = secp_ctx.sign(&msghash, &nodes[0].keys_manager.get_node_secret());
Expand All @@ -3045,7 +3046,7 @@ fn test_invalid_channel_announcement() {
assert!(nodes[0].router.handle_channel_announcement(&chan_announcement).is_err());

let mut unsigned_msg = dummy_unsigned_msg!();
unsigned_msg.chain_hash = Sha256dHash::from_data(&[1,2,3,4,5,6,7,8,9]);
unsigned_msg.chain_hash = Sha256dHash::hash(&[1,2,3,4,5,6,7,8,9]);
sign_msg!(unsigned_msg);
assert!(nodes[0].router.handle_channel_announcement(&chan_announcement).is_err());
}
Expand Down Expand Up @@ -3267,7 +3268,7 @@ macro_rules! check_spendable_outputs {
};
let secp_ctx = Secp256k1::new();
let remotepubkey = PublicKey::from_secret_key(&secp_ctx, &key);
let witness_script = Address::p2pkh(&remotepubkey, Network::Testnet).script_pubkey();
let witness_script = Address::p2pkh(&::bitcoin::PublicKey{compressed: true, key: remotepubkey}, Network::Testnet).script_pubkey();
let sighash = Message::from_slice(&bip143::SighashComponents::new(&spend_tx).sighash_all(&spend_tx.input[0], &witness_script, output.value)[..]).unwrap();
let remotesig = secp_ctx.sign(&sighash, key);
spend_tx.input[0].witness.push(remotesig.serialize_der().to_vec());
Expand Down Expand Up @@ -3322,7 +3323,7 @@ macro_rules! check_spendable_outputs {
let secret = {
match ExtendedPrivKey::new_master(Network::Testnet, &$node.node_seed) {
Ok(master_key) => {
match master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx($der_idx)) {
match master_key.ckd_priv(&secp_ctx, ChildNumber::from_hardened_idx($der_idx).expect("key space exhausted")) {
Ok(key) => key,
Err(_) => panic!("Your RNG is busted"),
}
Expand All @@ -3333,10 +3334,10 @@ macro_rules! check_spendable_outputs {
let pubkey = ExtendedPubKey::from_private(&secp_ctx, &secret).public_key;
let witness_script = Address::p2pkh(&pubkey, Network::Testnet).script_pubkey();
let sighash = Message::from_slice(&bip143::SighashComponents::new(&spend_tx).sighash_all(&spend_tx.input[0], &witness_script, output.value)[..]).unwrap();
let sig = secp_ctx.sign(&sighash, &secret.secret_key);
let sig = secp_ctx.sign(&sighash, &secret.private_key.key);
spend_tx.input[0].witness.push(sig.serialize_der().to_vec());
spend_tx.input[0].witness[0].push(SigHashType::All as u8);
spend_tx.input[0].witness.push(pubkey.serialize().to_vec());
spend_tx.input[0].witness.push(pubkey.key.serialize().to_vec());
txn.push(spend_tx);
},
}
Expand Down Expand Up @@ -4456,7 +4457,7 @@ impl msgs::ChannelUpdate {
msgs::ChannelUpdate {
signature: Signature::from(FFISignature::new()),
contents: msgs::UnsignedChannelUpdate {
chain_hash: Sha256dHash::from_data(&vec![0u8][..]),
chain_hash: Sha256dHash::hash(&vec![0u8][..]),
short_channel_id: 0,
timestamp: 0,
flags: 0,
Expand Down
Loading