node_id_2: if were_node_one { self.get_their_node_id() } else { our_node_id },
bitcoin_key_1: if were_node_one { our_bitcoin_key } else { self.their_funding_pubkey.unwrap() },
bitcoin_key_2: if were_node_one { self.their_funding_pubkey.unwrap() } else { our_bitcoin_key },
+ excess_data: Vec::new(),
};
let msghash = Message::from_slice(&Sha256dHash::from_data(&msg.encode()[..])[..]).unwrap();
pub node_id_2: PublicKey,
pub bitcoin_key_1: PublicKey,
pub bitcoin_key_2: PublicKey,
+ pub excess_data: Vec<u8>,
}
#[derive(PartialEq, Clone)]
pub struct ChannelAnnouncement {
}
let start = features.encoded_len();
let secp_ctx = Secp256k1::without_caps();
+ let mut excess_data = Vec::with_capacity(v.len() - start - 172);
+ excess_data.extend_from_slice(&v[start + 172..]);
Ok(Self {
features,
chain_hash: deserialize(&v[start..start + 32]).unwrap(),
node_id_2: secp_pubkey!(&secp_ctx, &v[start + 73..start + 106]),
bitcoin_key_1: secp_pubkey!(&secp_ctx, &v[start + 106..start + 139]),
bitcoin_key_2: secp_pubkey!(&secp_ctx, &v[start + 139..start + 172]),
+ excess_data,
})
}
}
impl MsgEncodable for UnsignedChannelAnnouncement {
fn encode(&self) -> Vec<u8> {
let features = self.features.encode();
- let mut res = Vec::with_capacity(172 + features.len());
+ let mut res = Vec::with_capacity(172 + features.len() + self.excess_data.len());
res.extend_from_slice(&features[..]);
res.extend_from_slice(&self.chain_hash[..]);
res.extend_from_slice(&byte_utils::be64_to_array(self.short_channel_id));
res.extend_from_slice(&self.node_id_2.serialize());
res.extend_from_slice(&self.bitcoin_key_1.serialize());
res.extend_from_slice(&self.bitcoin_key_2.serialize());
+ res.extend_from_slice(&self.excess_data[..]);
res
}
}
add_channel_to_node!(msg.contents.node_id_1);
add_channel_to_node!(msg.contents.node_id_2);
- Ok(!msg.contents.features.supports_unknown_bits())
+ Ok(msg.contents.excess_data.is_empty() && !msg.contents.features.supports_unknown_bits())
}
fn handle_htlc_fail_channel_update(&self, update: &msgs::HTLCFailChannelUpdate) {