Skip to content
Open
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
8 changes: 5 additions & 3 deletions crates/floresta-electrum/src/electrum_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ use floresta_compact_filters::network_filters::NetworkFilters;
use floresta_watch_only::kv_database::KvDatabase;
use floresta_watch_only::AddressCache;
use floresta_watch_only::CachedTransaction;
use floresta_wire::node_interface::NodeInterface;
use floresta_wire::node_handle::NodeHandle;
use floresta_wire::node_interface::BlockData;
use floresta_wire::node_interface::MempoolOperations;
use serde_json::json;
use serde_json::Value;
use tokio::io::AsyncBufReadExt;
Expand Down Expand Up @@ -200,7 +202,7 @@ pub struct ElectrumServer<Blockchain: BlockchainInterface> {

/// An interface to a running node, used to broadcast transactions and request
/// blocks.
node_interface: NodeInterface,
node_interface: NodeHandle,

/// A list of addresses that we've just learned about and need to rescan for
/// transactions.
Expand All @@ -221,7 +223,7 @@ impl<Blockchain: BlockchainInterface> ElectrumServer<Blockchain> {
address_cache: Arc<AddressCache<KvDatabase>>,
chain: Arc<Blockchain>,
block_filters: Option<Arc<NetworkFilters<FlatFiltersStore>>>,
node_interface: NodeInterface,
node_interface: NodeHandle,
) -> Result<ElectrumServer<Blockchain>, Box<dyn error::Error>> {
let (tx, rx) = unbounded_channel();

Expand Down
2 changes: 1 addition & 1 deletion crates/floresta-electrum/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ pub enum Error {
Mempool(Box<dyn core::error::Error + Send + 'static>),

#[error("Node isn't working")]
NodeInterface(#[from] oneshot::error::RecvError),
NodeHandle(#[from] oneshot::error::RecvError),
}
1 change: 1 addition & 0 deletions crates/floresta-node/src/json_rpc/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use corepc_types::v30::GetBlockVerboseOne;
use corepc_types::ScriptPubkey;
use floresta_chain::extensions::HeaderExt;
use floresta_chain::extensions::WorkExt;
use floresta_wire::node_interface::BlockData;
use miniscript::descriptor::checksum;
use serde_json::json;
use serde_json::Value;
Expand Down
1 change: 1 addition & 0 deletions crates/floresta-node/src/json_rpc/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use core::net::IpAddr;
use core::net::SocketAddr;

use bitcoin::Network;
use floresta_wire::node_interface::Networking;
use floresta_wire::node_interface::PeerInfo;
use serde_json::json;
use serde_json::Value;
Expand Down
10 changes: 6 additions & 4 deletions crates/floresta-node/src/json_rpc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ use floresta_compact_filters::network_filters::NetworkFilters;
use floresta_watch_only::kv_database::KvDatabase;
use floresta_watch_only::AddressCache;
use floresta_watch_only::CachedTransaction;
use floresta_wire::node_interface::NodeInterface;
use floresta_wire::node_handle::NodeHandle;
use floresta_wire::node_interface::BlockData;
use floresta_wire::node_interface::MempoolOperations;
use serde_json::json;
use serde_json::Value;
use tokio::sync::RwLock;
Expand Down Expand Up @@ -76,7 +78,7 @@ pub struct RpcImpl<Blockchain: RpcChain> {
pub(super) network: Network,
pub(super) chain: Blockchain,
pub(super) wallet: Arc<AddressCache<KvDatabase>>,
pub(super) node: NodeInterface,
pub(super) node: NodeHandle,
pub(super) kill_signal: Arc<RwLock<bool>>,
pub(super) inflight: Arc<RwLock<HashMap<Value, InflightRpc>>>,
pub(super) log_path: String,
Expand Down Expand Up @@ -572,7 +574,7 @@ impl<Blockchain: RpcChain> RpcImpl<Blockchain> {
chain: Blockchain,
wallet: Arc<AddressCache<KvDatabase>>,
cfilters: Arc<NetworkFilters<FlatFiltersStore>>,
node: NodeInterface,
node: NodeHandle,
start_height: Option<u32>,
stop_height: Option<u32>,
) -> Result<()> {
Expand Down Expand Up @@ -724,7 +726,7 @@ impl<Blockchain: RpcChain> RpcImpl<Blockchain> {
pub async fn create(
chain: Blockchain,
wallet: Arc<AddressCache<KvDatabase>>,
node: NodeInterface,
node: NodeHandle,
kill_signal: Arc<RwLock<bool>>,
network: Network,
block_filter_storage: Option<Arc<NetworkFilters<FlatFiltersStore>>>,
Expand Down
1 change: 1 addition & 0 deletions crates/floresta-wire/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub use p2p_wire::error;
pub use p2p_wire::node;
#[cfg(not(target_arch = "wasm32"))]
pub use p2p_wire::node_context;
pub use p2p_wire::node_handle;
#[cfg(not(target_arch = "wasm32"))]
pub use p2p_wire::node_interface;
pub use p2p_wire::transport::TransportProtocol;
Expand Down
1 change: 1 addition & 0 deletions crates/floresta-wire/src/p2p_wire/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ pub mod block_proof;
pub mod error;
pub mod node;
pub mod node_context;
pub mod node_handle;
pub mod node_interface;
pub mod peer;
pub mod socks;
Expand Down
4 changes: 2 additions & 2 deletions crates/floresta-wire/src/p2p_wire/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ use super::address_man::LocalAddress;
use super::block_proof::Bitmap;
use super::error::WireError;
use super::node_context::NodeContext;
use super::node_interface::NodeResponse;
use super::node_interface::UserRequest;
use super::node_handle::NodeResponse;
use super::node_handle::UserRequest;
use super::peer::PeerMessages;
use super::socks::Socks5StreamBuilder;
use super::transport::TransportProtocol;
Expand Down
4 changes: 2 additions & 2 deletions crates/floresta-wire/src/p2p_wire/node/peer_man.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ use crate::node::running_ctx::RunningNode;
use crate::node::try_and_log;
use crate::node_context::NodeContext;
use crate::node_context::PeerId;
use crate::node_interface::NodeResponse;
use crate::node_handle::NodeResponse;
use crate::node_handle::UserRequest;
use crate::node_interface::PeerInfo;
use crate::node_interface::UserRequest;
use crate::p2p_wire::error::WireError;
use crate::p2p_wire::peer::PeerMessages;
use crate::p2p_wire::peer::Version;
Expand Down
12 changes: 6 additions & 6 deletions crates/floresta-wire/src/p2p_wire/node/user_req.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ use super::UtreexoNode;
use crate::block_proof::Bitmap;
use crate::node::running_ctx::RunningNode;
use crate::node_context::NodeContext;
use crate::node_interface::NodeInterface;
use crate::node_interface::NodeResponse;
use crate::node_interface::UserRequest;
use crate::node_handle::NodeHandle;
use crate::node_handle::NodeResponse;
use crate::node_handle::UserRequest;
use crate::p2p_wire::error::WireError;

impl<T, Chain> UtreexoNode<Chain, T>
Expand All @@ -31,8 +31,8 @@ where
/// node. This struct is thread safe, so we can use it from multiple threads and have
/// multiple handles. It also doesn't require a mutable reference to the node, or any
/// synchronization mechanism.
pub fn get_handle(&self) -> NodeInterface {
NodeInterface::new(self.common.node_tx.clone())
pub fn get_handle(&self) -> NodeHandle {
NodeHandle::new(self.common.node_tx.clone())
}

/// Handles getpeerinfo requests, returning a list of all connected peers and some useful
Expand All @@ -49,7 +49,7 @@ where

/// Actually perform the user request
///
/// These are requests made by some consumer of `floresta-wire` using the [`NodeInterface`], and may
/// These are requests made by some consumer of `floresta-wire` using the [`NodeHandle`], and may
/// be a mempool transaction, a block, or a connection request.
pub(crate) async fn perform_user_request(
&mut self,
Expand Down
Loading
Loading