//! track the network on the less-secure system.
use secp256k1::key::PublicKey;
-use secp256k1::{Secp256k1, Signature};
+use secp256k1::Signature;
use secp256k1;
use bitcoin::util::hash::Sha256dHash;
use bitcoin::blockdata::script::Script;
use util::{byte_utils, events};
use util::ser::{Readable, Writeable, Writer};
+use ln::channelmanager::{PaymentPreimage, PaymentHash};
+
/// An error in decoding a message or struct.
#[derive(Debug)]
pub enum DecodeError {
pub(crate) channel_id: [u8; 32],
pub(crate) htlc_id: u64,
pub(crate) amount_msat: u64,
- pub(crate) payment_hash: [u8; 32],
+ pub(crate) payment_hash: PaymentHash,
pub(crate) cltv_expiry: u32,
pub(crate) onion_routing_packet: OnionPacket,
}
pub struct UpdateFulfillHTLC {
pub(crate) channel_id: [u8; 32],
pub(crate) htlc_id: u64,
- pub(crate) payment_preimage: [u8; 32],
+ pub(crate) payment_preimage: PaymentPreimage,
}
/// An update_fail_htlc message to be sent or received from a peer
}
}
+#[derive(Clone)]
// Only exposed as broadcast of node_announcement should be filtered by node_id
/// The unsigned part of a node_announcement
pub struct UnsignedNodeAnnouncement {
pub(crate) excess_address_data: Vec<u8>,
pub(crate) excess_data: Vec<u8>,
}
+#[derive(Clone)]
/// A node_announcement message to be sent or received from a peer
pub struct NodeAnnouncement {
pub(crate) signature: Signature,
fn handle_channel_update(&self, msg: &ChannelUpdate) -> Result<bool, HandleError>;
/// Handle some updates to the route graph that we learned due to an outbound failed payment.
fn handle_htlc_fail_channel_update(&self, update: &HTLCFailChannelUpdate);
+ /// Gets a subset of the channel announcements and updates required to dump our routing table
+ /// to a remote node, starting at the short_channel_id indicated by starting_point and
+ /// including batch_amount entries.
+ fn get_next_channel_announcements(&self, starting_point: u64, batch_amount: u8) -> Vec<(ChannelAnnouncement, ChannelUpdate, ChannelUpdate)>;
+ /// Gets a subset of the node announcements required to dump our routing table to a remote node,
+ /// starting at the node *after* the provided publickey and including batch_amount entries.
+ /// If None is provided for starting_point, we start at the first node.
+ fn get_next_node_announcements(&self, starting_point: Option<&PublicKey>, batch_amount: u8) -> Vec<NodeAnnouncement>;
}
pub(crate) struct OnionRealm0HopData {
public_key: {
let mut buf = [0u8;33];
r.read_exact(&mut buf)?;
- PublicKey::from_slice(&Secp256k1::without_caps(), &buf)
+ PublicKey::from_slice(&buf)
},
hop_data: Readable::read(r)?,
hmac: Readable::read(r)?,
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::decode("0101010101010101010101010101010101010101010101010101010101010101").unwrap()[..]).unwrap())
+ PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&hex::decode("0101010101010101010101010101010101010101010101010101010101010101").unwrap()[..]).unwrap())
};
let cr = msgs::ChannelReestablish {