}
impl MsgEncodable for UpdateAddHTLC {
fn encode(&self) -> Vec<u8> {
- let mut res = Vec::with_capacity(32+8+8+32+4+1+1366);
+ let mut res = Vec::with_capacity(32+8+8+32+4+1366);
res.extend_from_slice(&self.channel_id);
res.extend_from_slice(&byte_utils::be64_to_array(self.htlc_id));
res.extend_from_slice(&byte_utils::be64_to_array(self.amount_msat));
#[cfg(test)]
mod tests {
- use bitcoin::util::misc::hex_bytes;
+ use hex;
use ln::msgs::MsgEncodable;
use ln::msgs;
use secp256k1::key::{PublicKey,SecretKey};
fn encoding_channel_reestablish_no_secret() {
let public_key = {
let secp_ctx = Secp256k1::new();
- PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&secp_ctx, &hex_bytes("0101010101010101010101010101010101010101010101010101010101010101").unwrap()[..]).unwrap()).unwrap()
+ PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&secp_ctx, &hex::decode("0101010101010101010101010101010101010101010101010101010101010101").unwrap()[..]).unwrap()).unwrap()
};
let cr = msgs::ChannelReestablish {
fn encoding_channel_reestablish_with_secret() {
let public_key = {
let secp_ctx = Secp256k1::new();
- PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&secp_ctx, &hex_bytes("0101010101010101010101010101010101010101010101010101010101010101").unwrap()[..]).unwrap()).unwrap()
+ PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&secp_ctx, &hex::decode("0101010101010101010101010101010101010101010101010101010101010101").unwrap()[..]).unwrap()).unwrap()
};
let cr = msgs::ChannelReestablish {