zebra-network: move types -> protocol::types

These types are used for protocol messages, so it makes more sense to
keep them scoped with the protocol handling, rather than other
networking logic.
This commit is contained in:
Henry de Valence 2019-09-25 13:31:41 -07:00 committed by Deirdre Connolly
parent 19258d6f54
commit ab06750db3
9 changed files with 13 additions and 9 deletions

View File

@ -1,6 +1,7 @@
//! Definitions of constants.
use crate::types::*;
// XXX should these constants be split into protocol also?
use crate::protocol::types::*;
/// The User-Agent string provided by the node.
pub const USER_AGENT: &'static str = "Zebra v2.0.0-alpha.0";

View File

@ -11,7 +11,6 @@ mod network;
pub use network::Network;
pub mod protocol;
pub mod types;
// XXX make this private once connect is removed
pub mod meta_addr;

View File

@ -3,11 +3,14 @@
use chrono::{DateTime, Utc};
use std::net::SocketAddr;
use crate::types::Services;
use crate::protocol::types::Services;
/// An address with metadata on its advertised services and last-seen time.
///
/// [Bitcoin reference](https://en.bitcoin.it/wiki/Protocol_documentation#Network_address)
// XXX determine whether we will use this struct in *our* networking handling
// code, or just in the definitions of the networking protocol (in which case
// it should live in the protocol submodule)
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct MetaAddr {
/// The peer's address.

View File

@ -1,4 +1,4 @@
use crate::{constants::magics, types::Magic};
use crate::{constants::magics, protocol::types::Magic};
/// An enum describing the possible network choices.
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]

View File

@ -2,3 +2,4 @@
pub mod codec;
pub mod message;
pub mod types;

View File

@ -13,9 +13,9 @@ use zebra_chain::{
types::{BlockHeight, Sha256dChecksum},
};
use crate::{constants, types::*, Network};
use crate::{constants, Network};
use super::message::Message;
use super::{message::Message, types::*};
/// The length of a Bitcoin message header.
const HEADER_LEN: usize = 24usize;

View File

@ -8,7 +8,8 @@ use zebra_chain::block::Block;
use zebra_chain::{transaction::Transaction, types::BlockHeight};
use crate::meta_addr::MetaAddr;
use crate::types::*;
use super::types::*;
/// A Bitcoin-like network message for the Zcash protocol.
///

View File

@ -59,8 +59,7 @@ impl ConnectCmd {
use zebra_chain::types::BlockHeight;
use zebra_network::{
constants,
protocol::{codec::*, message::*},
types::*,
protocol::{codec::*, message::*, types::*},
Network,
};