Clarify roles in failing HTLCs, impl it, support rebalances
[rust-lightning] / src / ln / msgs.rs
index 3c56aa120ec43fb974c25c80c099411bd1f6c66e..3cdd4c77cb0efbd198b2c1ef782186e488088a6f 100644 (file)
@@ -205,12 +205,14 @@ pub struct UpdateFulfillHTLC {
        pub payment_preimage: [u8; 32],
 }
 
+#[derive(Clone)]
 pub struct UpdateFailHTLC {
        pub channel_id: Uint256,
        pub htlc_id: u64,
        pub reason: OnionErrorPacket,
 }
 
+#[derive(Clone)]
 pub struct UpdateFailMalformedHTLC {
        pub channel_id: Uint256,
        pub htlc_id: u64,
@@ -337,6 +339,9 @@ pub struct HandleError { //TODO: rename me
        pub msg: Option<ErrorMessage>, //TODO: Move into an Action enum and require it!
 }
 
+/// A trait to describe an object which can receive channel messages. Messages MAY be called in
+/// paralell when they originate from different their_node_ids, however they MUST NOT be called in
+/// paralell when the two calls have the same their_node_id.
 pub trait ChannelMessageHandler : events::EventsProvider {
        //Channel init:
        fn handle_open_channel(&self, their_node_id: &PublicKey, msg: &OpenChannel) -> Result<AcceptChannel, HandleError>;
@@ -399,6 +404,7 @@ pub struct DecodedOnionErrorPacket {
        pub pad: Vec<u8>,
 }
 
+#[derive(Clone)]
 pub struct OnionErrorPacket {
        // This really should be a constant size slice, but the spec lets these things be up to 128KB?
        // (TODO) We limit it in decode to much lower...