Skip to content

Commit

Permalink
Resolve moved lnp-core deps
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCharlatan committed Feb 21, 2022
1 parent b18378c commit 888949d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
3 changes: 1 addition & 2 deletions src/farcasterd/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ use internet2::{
addr::InetSocketAddr, NodeAddr, RemoteNodeAddr, RemoteSocketAddr, ToNodeAddr, TypedEnum,
UrlString,
};
use lnp::{message, Messages, TempChannelId as TempSwapId, LIGHTNING_P2P_DEFAULT_PORT};
use lnpbp::chain::Chain;
use microservices::esb::{self, Handler};
use microservices::rpc::Failure;
Expand Down Expand Up @@ -968,7 +967,7 @@ impl Runtime {
remote_addr: RemoteSocketAddr::Ftcp(peer_address), /* expected RemoteSocketAddr */
};
let peer = daemon_service
.to_node_addr(LIGHTNING_P2P_DEFAULT_PORT)
.to_node_addr(internet2::LIGHTNING_P2P_DEFAULT_PORT)
.ok_or(internet2::presentation::Error::InvalidEndpoint)?;

// Connect
Expand Down
17 changes: 7 additions & 10 deletions src/peerd/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ use std::{collections::HashMap, sync::Arc};
use std::{rc::Rc, thread::spawn};

use amplify::Bipolar;
use bitcoin::secp256k1::rand::{self, Rng};
use bitcoin::secp256k1::rand::{self, Rng, RngCore};
use bitcoin::secp256k1::PublicKey;
use internet2::{addr::InetSocketAddr, CreateUnmarshaller, Unmarshall, Unmarshaller};
use internet2::{presentation, transport, zmqsocket, NodeAddr, TypedEnum, ZmqType, ZMQ_CONTEXT};
use lnp::{message, Message};
use lnp::p2p::legacy::{Messages, Ping};
use microservices::esb::{self, Handler};
use microservices::node::TryService;
use microservices::peer::{self, PeerConnection, PeerSender, SendMessage};
Expand Down Expand Up @@ -377,11 +377,7 @@ impl Runtime {
}

match &request {
Request::Protocol(Msg::PingPeer) => self.ping()?,

Request::Protocol(Msg::Ping(message::Ping { pong_size, .. })) => {
self.pong(*pong_size)?
}
Request::Protocol(Msg::Ping(Ping { pong_size, .. })) => self.pong(*pong_size)?,

Request::Protocol(Msg::Pong(noise)) => {
match self.awaited_pong {
Expand Down Expand Up @@ -498,11 +494,12 @@ impl Runtime {
}
let mut rng = rand::thread_rng();
let len: u16 = rng.gen_range(4, 32);
let noise = vec![0u8; len as usize].iter().map(|_| rng.gen()).collect();
let mut noise = vec![0u8; len as usize];
rng.fill_bytes(&mut noise);
let pong_size = rng.gen_range(4, 32);
self.messages_sent += 1;
self.sender.send_message(Msg::Ping(message::Ping {
ignored: noise,
self.sender.send_message(Msg::Ping(Ping {
ignored: noise.into(),
pong_size,
}))?;
self.awaited_pong = Some(pong_size);
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/messages.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use amplify::DumbDefault;
use lnp::ChannelId as SwapId;
use lnp::p2p::legacy::ChannelId as SwapId;
use std::collections::HashSet;
use std::fmt::{self, Display, Formatter};
use std::io;
Expand Down
9 changes: 4 additions & 5 deletions src/rpc/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ use farcaster_core::{
};
use internet2::Api;
use internet2::{NodeAddr, RemoteSocketAddr};
use lnp::payment::{self, AssetsBalance, Lifecycle};
use lnp::{message, Messages, TempChannelId as TempSwapId};
use lnp::p2p::legacy::{Messages, Ping, TempChannelId as TempSwapId};
use microservices::rpc::Failure;
use microservices::rpc_connection;
use strict_encoding::{
Expand Down Expand Up @@ -104,7 +103,7 @@ pub enum Msg {
BuyProcedureSignature(protocol_message::BuyProcedureSignature<BtcXmr>),
#[api(type = 29)]
#[display(inner)]
Ping(message::Ping),
Ping(Ping),
#[api(type = 31)]
#[display("pong(...)")]
Pong(Vec<u8>),
Expand Down Expand Up @@ -852,9 +851,9 @@ pub struct SwapInfo {
//// FIXME serde::Serialize/Deserialize missing
// #[serde_as(as = "Option<DisplayFromStr)>")]
// pub params: Option<Params>,
pub local_keys: payment::channel::Keyset,
pub local_keys: lnp::channel::bolt::LocalKeyset,
#[serde_as(as = "BTreeMap<DisplayFromStr, Same>")]
pub remote_keys: BTreeMap<NodeAddr, payment::channel::Keyset>,
pub remote_keys: BTreeMap<NodeAddr, lnp::channel::bolt::RemoteKeyset>,
}

#[cfg(feature = "serde")]
Expand Down
1 change: 0 additions & 1 deletion src/syncerd/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use farcaster_core::swap::SwapId;
use internet2::{
presentation, transport, zmqsocket, NodeAddr, RemoteSocketAddr, TypedEnum, ZmqType, ZMQ_CONTEXT,
};
use lnp::{message, Messages, TempChannelId as TempSwapId};
use microservices::esb::{self, Handler};
use microservices::rpc::Failure;

Expand Down

0 comments on commit 888949d

Please sign in to comment.