Skip to content

Some API Quirks #29

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 3 commits into from
Jun 14, 2018
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
43 changes: 0 additions & 43 deletions src/chain/bitcoincorerpcchain.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/chain/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pub mod chaininterface;
pub mod bitcoincorerpcchain;
4 changes: 2 additions & 2 deletions src/ln/msgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ pub enum HTLCFailChannelUpdate {
/// 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 {
pub trait ChannelMessageHandler : events::EventsProvider + Send + Sync {
//Channel init:
fn handle_open_channel(&self, their_node_id: &PublicKey, msg: &OpenChannel) -> Result<AcceptChannel, HandleError>;
fn handle_accept_channel(&self, their_node_id: &PublicKey, msg: &AcceptChannel) -> Result<(), HandleError>;
Expand Down Expand Up @@ -419,7 +419,7 @@ pub trait ChannelMessageHandler : events::EventsProvider {
fn peer_disconnected(&self, their_node_id: &PublicKey, no_connection_possible: bool);
}

pub trait RoutingMessageHandler {
pub trait RoutingMessageHandler : Send + Sync {
fn handle_node_announcement(&self, msg: &NodeAnnouncement) -> Result<(), HandleError>;
/// Handle a channel_announcement message, returning true if it should be forwarded on, false
/// or returning an Err otherwise.
Expand Down
12 changes: 11 additions & 1 deletion src/ln/peer_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use util::events::{EventsProvider,Event};

use std::collections::{HashMap,LinkedList};
use std::sync::{Arc, Mutex};
use std::{cmp,mem,hash,fmt};
use std::{cmp,error,mem,hash,fmt};

pub struct MessageHandler {
pub chan_handler: Arc<msgs::ChannelMessageHandler>,
Expand Down Expand Up @@ -48,6 +48,16 @@ impl fmt::Debug for PeerHandleError {
formatter.write_str("Peer Sent Invalid Data")
}
}
impl fmt::Display for PeerHandleError {
fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
formatter.write_str("Peer Sent Invalid Data")
}
}
impl error::Error for PeerHandleError {
fn description(&self) -> &str {
"Peer Sent Invalid Data"
}
}

struct Peer {
channel_encryptor: PeerChannelEncryptor,
Expand Down