mirror of
https://github.com/hinto-janai/cuprate.git
synced 2024-11-17 00:07:53 +00:00
fix all use
This commit is contained in:
parent
47d157a4d1
commit
d6ed5a918f
52 changed files with 165 additions and 142 deletions
|
@ -10,7 +10,7 @@ pub use paste::paste;
|
|||
/// // see: <https://github.com/rust-lang/rust/issues/64079>
|
||||
/// mod visibility {
|
||||
///
|
||||
/// use epee_encoding::epee_object;
|
||||
/// use cuprate_epee_encoding::epee_object;
|
||||
///
|
||||
/// struct Example {
|
||||
/// a: u8
|
||||
|
@ -30,7 +30,7 @@ pub use paste::paste;
|
|||
/// // see: <https://github.com/rust-lang/rust/issues/64079>
|
||||
/// mod visibility {
|
||||
///
|
||||
/// use epee_encoding::epee_object;
|
||||
/// use cuprate_epee_encoding::epee_object;
|
||||
///
|
||||
/// struct Example {
|
||||
/// a: u8,
|
||||
|
@ -60,7 +60,7 @@ pub use paste::paste;
|
|||
/// c: u8 as u8,
|
||||
/// // `=> read_fn, write_fn, should_write_fn,` allows you to specify alt field encoding functions.
|
||||
/// // for the required args see the default functions, which are used here:
|
||||
/// d: u8 => epee_encoding::read_epee_value, epee_encoding::write_field, <u8 as epee_encoding::EpeeValue>::should_write,
|
||||
/// d: u8 => cuprate_epee_encoding::read_epee_value, cuprate_epee_encoding::write_field, <u8 as cuprate_epee_encoding::EpeeValue>::should_write,
|
||||
/// // `!flatten` can be used on fields which are epee objects, and it flattens the fields of that object into this object.
|
||||
/// // So for this example `e_f` will not appear in the data but e will.
|
||||
/// // You can't use the other options with this.
|
||||
|
@ -126,25 +126,25 @@ macro_rules! epee_object {
|
|||
$(!flatten: $flat_field: ident: $flat_ty:ty ,)*
|
||||
|
||||
) => {
|
||||
epee_encoding::macros::paste!(
|
||||
cuprate_epee_encoding::macros::paste!(
|
||||
#[allow(non_snake_case)]
|
||||
mod [<__epee_builder_ $obj>] {
|
||||
use super::*;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct [<__Builder $obj>] {
|
||||
$($field: Option<epee_encoding::epee_object!(@internal_field_type $ty, $($ty_as)?)>,)*
|
||||
$($flat_field: <$flat_ty as epee_encoding::EpeeObject>::Builder,)*
|
||||
$($field: Option<cuprate_epee_encoding::epee_object!(@internal_field_type $ty, $($ty_as)?)>,)*
|
||||
$($flat_field: <$flat_ty as cuprate_epee_encoding::EpeeObject>::Builder,)*
|
||||
}
|
||||
|
||||
impl epee_encoding::EpeeObjectBuilder<$obj> for [<__Builder $obj>] {
|
||||
fn add_field<B: epee_encoding::macros::bytes::Buf>(&mut self, name: &str, b: &mut B) -> epee_encoding::error::Result<bool> {
|
||||
impl cuprate_epee_encoding::EpeeObjectBuilder<$obj> for [<__Builder $obj>] {
|
||||
fn add_field<B: cuprate_epee_encoding::macros::bytes::Buf>(&mut self, name: &str, b: &mut B) -> cuprate_epee_encoding::error::Result<bool> {
|
||||
match name {
|
||||
$(epee_encoding::epee_object!(@internal_field_name $field, $($alt_name)?) => {
|
||||
$(cuprate_epee_encoding::epee_object!(@internal_field_name $field, $($alt_name)?) => {
|
||||
if core::mem::replace(&mut self.$field, Some(
|
||||
epee_encoding::epee_object!(@internal_try_right_then_left epee_encoding::read_epee_value(b)?, $($read_fn(b)?)?)
|
||||
cuprate_epee_encoding::epee_object!(@internal_try_right_then_left cuprate_epee_encoding::read_epee_value(b)?, $($read_fn(b)?)?)
|
||||
)).is_some() {
|
||||
Err(epee_encoding::error::Error::Value(format!("Duplicate field in data: {}", epee_encoding::epee_object!(@internal_field_name$field, $($alt_name)?))))?;
|
||||
Err(cuprate_epee_encoding::error::Error::Value(format!("Duplicate field in data: {}", cuprate_epee_encoding::epee_object!(@internal_field_name$field, $($alt_name)?))))?;
|
||||
}
|
||||
Ok(true)
|
||||
},)*
|
||||
|
@ -159,12 +159,12 @@ macro_rules! epee_object {
|
|||
}
|
||||
}
|
||||
|
||||
fn finish(self) -> epee_encoding::error::Result<$obj> {
|
||||
fn finish(self) -> cuprate_epee_encoding::error::Result<$obj> {
|
||||
Ok(
|
||||
$obj {
|
||||
$(
|
||||
$field: {
|
||||
let epee_default_value = epee_encoding::epee_object!(@internal_try_right_then_left epee_encoding::EpeeValue::epee_default_value(), $({
|
||||
let epee_default_value = cuprate_epee_encoding::epee_object!(@internal_try_right_then_left cuprate_epee_encoding::EpeeValue::epee_default_value(), $({
|
||||
let _ = $should_write_fn;
|
||||
None
|
||||
})?);
|
||||
|
@ -173,7 +173,7 @@ macro_rules! epee_object {
|
|||
$(.or(Some($default)))?
|
||||
.or(epee_default_value)
|
||||
$(.map(<$ty_as>::into))?
|
||||
.ok_or(epee_encoding::error::Error::Value(format!("Missing field in data: {}", epee_encoding::epee_object!(@internal_field_name$field, $($alt_name)?))))?
|
||||
.ok_or(cuprate_epee_encoding::error::Error::Value(format!("Missing field in data: {}", cuprate_epee_encoding::epee_object!(@internal_field_name$field, $($alt_name)?))))?
|
||||
},
|
||||
)*
|
||||
|
||||
|
@ -187,16 +187,16 @@ macro_rules! epee_object {
|
|||
}
|
||||
}
|
||||
|
||||
impl epee_encoding::EpeeObject for $obj {
|
||||
impl cuprate_epee_encoding::EpeeObject for $obj {
|
||||
type Builder = [<__epee_builder_ $obj>]::[<__Builder $obj>];
|
||||
|
||||
fn number_of_fields(&self) -> u64 {
|
||||
let mut fields = 0;
|
||||
|
||||
$(
|
||||
let field = epee_encoding::epee_object!(@internal_try_right_then_left &self.$field, $(<&$ty_as>::from(&self.$field))? );
|
||||
let field = cuprate_epee_encoding::epee_object!(@internal_try_right_then_left &self.$field, $(<&$ty_as>::from(&self.$field))? );
|
||||
|
||||
if $((field) != &$default &&)? epee_encoding::epee_object!(@internal_try_right_then_left epee_encoding::EpeeValue::should_write, $($should_write_fn)?)(field )
|
||||
if $((field) != &$default &&)? cuprate_epee_encoding::epee_object!(@internal_try_right_then_left cuprate_epee_encoding::EpeeValue::should_write, $($should_write_fn)?)(field )
|
||||
{
|
||||
fields += 1;
|
||||
}
|
||||
|
@ -209,13 +209,13 @@ macro_rules! epee_object {
|
|||
fields
|
||||
}
|
||||
|
||||
fn write_fields<B: epee_encoding::macros::bytes::BufMut>(self, w: &mut B) -> epee_encoding::error::Result<()> {
|
||||
fn write_fields<B: cuprate_epee_encoding::macros::bytes::BufMut>(self, w: &mut B) -> cuprate_epee_encoding::error::Result<()> {
|
||||
$(
|
||||
let field = epee_encoding::epee_object!(@internal_try_right_then_left self.$field, $(<$ty_as>::from(self.$field))? );
|
||||
let field = cuprate_epee_encoding::epee_object!(@internal_try_right_then_left self.$field, $(<$ty_as>::from(self.$field))? );
|
||||
|
||||
if $(field != $default &&)? epee_encoding::epee_object!(@internal_try_right_then_left epee_encoding::EpeeValue::should_write, $($should_write_fn)?)(&field )
|
||||
if $(field != $default &&)? cuprate_epee_encoding::epee_object!(@internal_try_right_then_left cuprate_epee_encoding::EpeeValue::should_write, $($should_write_fn)?)(&field )
|
||||
{
|
||||
epee_encoding::epee_object!(@internal_try_right_then_left epee_encoding::write_field, $($write_fn)?)((field), epee_encoding::epee_object!(@internal_field_name$field, $($alt_name)?), w)?;
|
||||
cuprate_epee_encoding::epee_object!(@internal_try_right_then_left cuprate_epee_encoding::write_field, $($write_fn)?)((field), cuprate_epee_encoding::epee_object!(@internal_field_name$field, $($alt_name)?), w)?;
|
||||
}
|
||||
)*
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ use core::fmt::Debug;
|
|||
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
||||
use sealed::sealed;
|
||||
|
||||
use fixed_bytes::{ByteArray, ByteArrayVec};
|
||||
use cuprate_fixed_bytes::{ByteArray, ByteArrayVec};
|
||||
|
||||
use crate::{
|
||||
io::*, varint::*, EpeeObject, Error, InnerMarker, Marker, Result, MAX_STRING_LEN_POSSIBLE,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use epee_encoding::{epee_object, from_bytes, to_bytes};
|
||||
use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes};
|
||||
|
||||
struct AltName {
|
||||
val: u8,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use epee_encoding::{epee_object, from_bytes};
|
||||
use cuprate_epee_encoding::{epee_object, from_bytes};
|
||||
|
||||
struct T {
|
||||
a: u8,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use epee_encoding::{epee_object, from_bytes, to_bytes};
|
||||
use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes};
|
||||
|
||||
pub struct Optional {
|
||||
val: u8,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use epee_encoding::{epee_object, from_bytes, to_bytes};
|
||||
use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes};
|
||||
|
||||
struct Child {
|
||||
val: u64,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use epee_encoding::{epee_object, from_bytes, to_bytes};
|
||||
use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes};
|
||||
use std::ops::Deref;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use epee_encoding::{epee_object, from_bytes, to_bytes};
|
||||
use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes};
|
||||
|
||||
#[derive(Eq, PartialEq, Debug, Clone)]
|
||||
pub struct SupportFlags(u32);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use epee_encoding::{epee_object, from_bytes, to_bytes};
|
||||
use cuprate_epee_encoding::{epee_object, from_bytes, to_bytes};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
struct BaseResponse {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use epee_encoding::{epee_object, from_bytes};
|
||||
use cuprate_epee_encoding::{epee_object, from_bytes};
|
||||
|
||||
struct ObjSeq {
|
||||
seq: Vec<ObjSeq>,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use epee_encoding::{epee_object, from_bytes};
|
||||
use cuprate_epee_encoding::{epee_object, from_bytes};
|
||||
|
||||
struct D {
|
||||
val: u8,
|
||||
|
|
|
@ -8,7 +8,7 @@ use tokio::{
|
|||
};
|
||||
use tokio_util::codec::{FramedRead, FramedWrite};
|
||||
|
||||
use levin_cuprate::{
|
||||
use cuprate_levin::{
|
||||
message::make_fragmented_messages, BucketBuilder, BucketError, LevinBody, LevinCommand,
|
||||
LevinMessageCodec, MessageType, Protocol,
|
||||
};
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
pub mod network_address;
|
||||
pub mod p2p;
|
||||
|
||||
pub use levin_cuprate::BucketError;
|
||||
pub use cuprate_levin::BucketError;
|
||||
pub use network_address::{NetZone, NetworkAddress};
|
||||
pub use p2p::*;
|
||||
|
||||
// re-export.
|
||||
pub use levin_cuprate as levin;
|
||||
pub use cuprate_levin as levin;
|
||||
|
||||
pub type MoneroWireCodec = levin_cuprate::codec::LevinMessageCodec<Message>;
|
||||
pub type MoneroWireCodec = cuprate_levin::codec::LevinMessageCodec<Message>;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
//! I2p. Currently this module only has IPv(4/6).
|
||||
//!
|
||||
use bytes::BufMut;
|
||||
use epee_encoding::EpeeObject;
|
||||
use cuprate_epee_encoding::EpeeObject;
|
||||
use std::{hash::Hash, net, net::SocketAddr};
|
||||
|
||||
mod epee_builder;
|
||||
|
@ -45,7 +45,7 @@ impl EpeeObject for NetworkAddress {
|
|||
2
|
||||
}
|
||||
|
||||
fn write_fields<B: BufMut>(self, w: &mut B) -> epee_encoding::Result<()> {
|
||||
fn write_fields<B: BufMut>(self, w: &mut B) -> cuprate_epee_encoding::Result<()> {
|
||||
TaggedNetworkAddress::from(self).write_fields(w)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use bytes::Buf;
|
||||
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
|
||||
|
||||
use epee_encoding::{epee_object, EpeeObjectBuilder};
|
||||
use cuprate_epee_encoding::{epee_object, EpeeObjectBuilder};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::NetworkAddress;
|
||||
|
@ -19,19 +19,28 @@ epee_object!(
|
|||
);
|
||||
|
||||
impl EpeeObjectBuilder<NetworkAddress> for TaggedNetworkAddress {
|
||||
fn add_field<B: Buf>(&mut self, name: &str, b: &mut B) -> epee_encoding::Result<bool> {
|
||||
fn add_field<B: Buf>(&mut self, name: &str, b: &mut B) -> cuprate_epee_encoding::Result<bool> {
|
||||
match name {
|
||||
"type" => {
|
||||
if std::mem::replace(&mut self.ty, Some(epee_encoding::read_epee_value(b)?))
|
||||
.is_some()
|
||||
if std::mem::replace(
|
||||
&mut self.ty,
|
||||
Some(cuprate_epee_encoding::read_epee_value(b)?),
|
||||
)
|
||||
.is_some()
|
||||
{
|
||||
return Err(epee_encoding::Error::Format("Duplicate field in data."));
|
||||
return Err(cuprate_epee_encoding::Error::Format(
|
||||
"Duplicate field in data.",
|
||||
));
|
||||
}
|
||||
Ok(true)
|
||||
}
|
||||
"addr" => {
|
||||
if std::mem::replace(&mut self.addr, epee_encoding::read_epee_value(b)?).is_some() {
|
||||
return Err(epee_encoding::Error::Format("Duplicate field in data."));
|
||||
if std::mem::replace(&mut self.addr, cuprate_epee_encoding::read_epee_value(b)?)
|
||||
.is_some()
|
||||
{
|
||||
return Err(cuprate_epee_encoding::Error::Format(
|
||||
"Duplicate field in data.",
|
||||
));
|
||||
}
|
||||
Ok(true)
|
||||
}
|
||||
|
@ -39,9 +48,9 @@ impl EpeeObjectBuilder<NetworkAddress> for TaggedNetworkAddress {
|
|||
}
|
||||
}
|
||||
|
||||
fn finish(self) -> epee_encoding::Result<NetworkAddress> {
|
||||
fn finish(self) -> cuprate_epee_encoding::Result<NetworkAddress> {
|
||||
self.try_into()
|
||||
.map_err(|_| epee_encoding::Error::Value("Invalid network address".to_string()))
|
||||
.map_err(|_| cuprate_epee_encoding::Error::Value("Invalid network address".to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ use std::fmt::Formatter;
|
|||
|
||||
use bytes::{Buf, BytesMut};
|
||||
|
||||
use epee_encoding::epee_object;
|
||||
use levin_cuprate::{
|
||||
use cuprate_epee_encoding::epee_object;
|
||||
use cuprate_levin::{
|
||||
BucketBuilder, BucketError, LevinBody, LevinCommand as LevinCommandTrait, MessageType,
|
||||
};
|
||||
|
||||
|
@ -154,22 +154,23 @@ impl From<LevinCommand> for u32 {
|
|||
}
|
||||
}
|
||||
|
||||
fn decode_message<B: Buf, T: epee_encoding::EpeeObject, Ret>(
|
||||
fn decode_message<B: Buf, T: cuprate_epee_encoding::EpeeObject, Ret>(
|
||||
ret: impl FnOnce(T) -> Ret,
|
||||
buf: &mut B,
|
||||
) -> Result<Ret, BucketError> {
|
||||
let t = epee_encoding::from_bytes(buf).map_err(|e| BucketError::BodyDecodingError(e.into()))?;
|
||||
let t = cuprate_epee_encoding::from_bytes(buf)
|
||||
.map_err(|e| BucketError::BodyDecodingError(e.into()))?;
|
||||
Ok(ret(t))
|
||||
}
|
||||
|
||||
fn build_message<T: epee_encoding::EpeeObject>(
|
||||
fn build_message<T: cuprate_epee_encoding::EpeeObject>(
|
||||
id: LevinCommand,
|
||||
val: T,
|
||||
builder: &mut BucketBuilder<LevinCommand>,
|
||||
) -> Result<(), BucketError> {
|
||||
builder.set_command(id);
|
||||
builder.set_body(
|
||||
epee_encoding::to_bytes(val)
|
||||
cuprate_epee_encoding::to_bytes(val)
|
||||
.map(BytesMut::freeze)
|
||||
.map_err(|e| BucketError::BodyDecodingError(e.into()))?,
|
||||
);
|
||||
|
@ -280,13 +281,13 @@ impl RequestMessage {
|
|||
C::Handshake => decode_message(RequestMessage::Handshake, buf)?,
|
||||
C::TimedSync => decode_message(RequestMessage::TimedSync, buf)?,
|
||||
C::Ping => {
|
||||
epee_encoding::from_bytes::<EmptyMessage, _>(buf)
|
||||
cuprate_epee_encoding::from_bytes::<EmptyMessage, _>(buf)
|
||||
.map_err(|e| BucketError::BodyDecodingError(e.into()))?;
|
||||
|
||||
RequestMessage::Ping
|
||||
}
|
||||
C::SupportFlags => {
|
||||
epee_encoding::from_bytes::<EmptyMessage, _>(buf)
|
||||
cuprate_epee_encoding::from_bytes::<EmptyMessage, _>(buf)
|
||||
.map_err(|e| BucketError::BodyDecodingError(e.into()))?;
|
||||
|
||||
RequestMessage::SupportFlags
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
//! protocol messages.
|
||||
|
||||
use bytes::Bytes;
|
||||
use epee_encoding::epee_object;
|
||||
use cuprate_epee_encoding::epee_object;
|
||||
|
||||
use super::common::{BasicNodeData, CoreSyncData, PeerListEntryBase, PeerSupportFlags};
|
||||
|
||||
|
@ -134,7 +134,8 @@ mod tests {
|
|||
186, 15, 178, 70, 173, 170, 187, 31, 70, 50, 227, 11, 116, 111, 112, 95, 118, 101, 114,
|
||||
115, 105, 111, 110, 8, 1,
|
||||
];
|
||||
let handshake: HandshakeRequest = epee_encoding::from_bytes(&mut &bytes[..]).unwrap();
|
||||
let handshake: HandshakeRequest =
|
||||
cuprate_epee_encoding::from_bytes(&mut &bytes[..]).unwrap();
|
||||
let basic_node_data = BasicNodeData {
|
||||
my_port: 0,
|
||||
network_id: [
|
||||
|
@ -161,8 +162,9 @@ mod tests {
|
|||
assert_eq!(basic_node_data, handshake.node_data);
|
||||
assert_eq!(core_sync_data, handshake.payload_data);
|
||||
|
||||
let mut encoded_bytes = epee_encoding::to_bytes(handshake.clone()).unwrap();
|
||||
let handshake_2: HandshakeRequest = epee_encoding::from_bytes(&mut encoded_bytes).unwrap();
|
||||
let mut encoded_bytes = cuprate_epee_encoding::to_bytes(handshake.clone()).unwrap();
|
||||
let handshake_2: HandshakeRequest =
|
||||
cuprate_epee_encoding::from_bytes(&mut encoded_bytes).unwrap();
|
||||
|
||||
assert_eq!(handshake, handshake_2);
|
||||
}
|
||||
|
@ -938,7 +940,8 @@ mod tests {
|
|||
181, 216, 193, 135, 23, 186, 168, 207, 119, 86, 235, 11, 116, 111, 112, 95, 118, 101,
|
||||
114, 115, 105, 111, 110, 8, 16,
|
||||
];
|
||||
let handshake: HandshakeResponse = epee_encoding::from_bytes(&mut &bytes[..]).unwrap();
|
||||
let handshake: HandshakeResponse =
|
||||
cuprate_epee_encoding::from_bytes(&mut &bytes[..]).unwrap();
|
||||
|
||||
let basic_node_data = BasicNodeData {
|
||||
my_port: 18080,
|
||||
|
@ -967,9 +970,10 @@ mod tests {
|
|||
assert_eq!(core_sync_data, handshake.payload_data);
|
||||
assert_eq!(250, handshake.local_peerlist_new.len());
|
||||
|
||||
let mut encoded_bytes = epee_encoding::to_bytes(handshake.clone()).unwrap();
|
||||
let mut encoded_bytes = cuprate_epee_encoding::to_bytes(handshake.clone()).unwrap();
|
||||
|
||||
let handshake_2: HandshakeResponse = epee_encoding::from_bytes(&mut encoded_bytes).unwrap();
|
||||
let handshake_2: HandshakeResponse =
|
||||
cuprate_epee_encoding::from_bytes(&mut encoded_bytes).unwrap();
|
||||
|
||||
assert_eq!(handshake, handshake_2);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
use bitflags::bitflags;
|
||||
use bytes::{Buf, BufMut, Bytes};
|
||||
|
||||
use epee_encoding::{epee_object, EpeeValue, InnerMarker};
|
||||
use fixed_bytes::ByteArray;
|
||||
use cuprate_epee_encoding::{epee_object, EpeeValue, InnerMarker};
|
||||
use cuprate_fixed_bytes::ByteArray;
|
||||
|
||||
use crate::NetworkAddress;
|
||||
|
||||
|
@ -241,12 +241,12 @@ epee_object!(
|
|||
txs: TransactionBlobs = TransactionBlobs::None => tx_blob_read, tx_blob_write, should_write_tx_blobs,
|
||||
);
|
||||
|
||||
fn tx_blob_read<B: Buf>(b: &mut B) -> epee_encoding::Result<TransactionBlobs> {
|
||||
let marker = epee_encoding::read_marker(b)?;
|
||||
fn tx_blob_read<B: Buf>(b: &mut B) -> cuprate_epee_encoding::Result<TransactionBlobs> {
|
||||
let marker = cuprate_epee_encoding::read_marker(b)?;
|
||||
match marker.inner_marker {
|
||||
InnerMarker::Object => Ok(TransactionBlobs::Pruned(Vec::read(b, &marker)?)),
|
||||
InnerMarker::String => Ok(TransactionBlobs::Normal(Vec::read(b, &marker)?)),
|
||||
_ => Err(epee_encoding::Error::Value(
|
||||
_ => Err(cuprate_epee_encoding::Error::Value(
|
||||
"Invalid marker for tx blobs".to_string(),
|
||||
)),
|
||||
}
|
||||
|
@ -256,11 +256,15 @@ fn tx_blob_write<B: BufMut>(
|
|||
val: TransactionBlobs,
|
||||
field_name: &str,
|
||||
w: &mut B,
|
||||
) -> epee_encoding::Result<()> {
|
||||
) -> cuprate_epee_encoding::Result<()> {
|
||||
if should_write_tx_blobs(&val) {
|
||||
match val {
|
||||
TransactionBlobs::Normal(bytes) => epee_encoding::write_field(bytes, field_name, w)?,
|
||||
TransactionBlobs::Pruned(obj) => epee_encoding::write_field(obj, field_name, w)?,
|
||||
TransactionBlobs::Normal(bytes) => {
|
||||
cuprate_epee_encoding::write_field(bytes, field_name, w)?
|
||||
}
|
||||
TransactionBlobs::Pruned(obj) => {
|
||||
cuprate_epee_encoding::write_field(obj, field_name, w)?
|
||||
}
|
||||
TransactionBlobs::None => (),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
use bytes::Bytes;
|
||||
|
||||
use epee_encoding::{container_as_blob::ContainerAsBlob, epee_object};
|
||||
use fixed_bytes::{ByteArray, ByteArrayVec};
|
||||
use cuprate_epee_encoding::{container_as_blob::ContainerAsBlob, epee_object};
|
||||
use cuprate_fixed_bytes::{ByteArray, ByteArrayVec};
|
||||
|
||||
use super::common::BlockCompleteEntry;
|
||||
|
||||
|
@ -705,13 +705,14 @@ mod tests {
|
|||
248, 248, 91, 110, 107, 144, 12, 175, 253, 21, 121, 28,
|
||||
];
|
||||
|
||||
let new_transactions: NewTransactions = epee_encoding::from_bytes(&mut &bytes[..]).unwrap();
|
||||
let new_transactions: NewTransactions =
|
||||
cuprate_epee_encoding::from_bytes(&mut &bytes[..]).unwrap();
|
||||
|
||||
assert_eq!(4, new_transactions.txs.len());
|
||||
|
||||
let mut encoded_bytes = epee_encoding::to_bytes(new_transactions.clone()).unwrap();
|
||||
let mut encoded_bytes = cuprate_epee_encoding::to_bytes(new_transactions.clone()).unwrap();
|
||||
let new_transactions_2: NewTransactions =
|
||||
epee_encoding::from_bytes(&mut encoded_bytes).unwrap();
|
||||
cuprate_epee_encoding::from_bytes(&mut encoded_bytes).unwrap();
|
||||
|
||||
assert_eq!(new_transactions, new_transactions_2);
|
||||
}
|
||||
|
@ -1057,10 +1058,12 @@ mod tests {
|
|||
101, 110, 116, 95, 98, 108, 111, 99, 107, 99, 104, 97, 105, 110, 95, 104, 101, 105,
|
||||
103, 104, 116, 5, 209, 45, 42, 0, 0, 0, 0, 0,
|
||||
];
|
||||
let fluffy_block: NewFluffyBlock = epee_encoding::from_bytes(&mut &bytes[..]).unwrap();
|
||||
let fluffy_block: NewFluffyBlock =
|
||||
cuprate_epee_encoding::from_bytes(&mut &bytes[..]).unwrap();
|
||||
|
||||
let mut encoded_bytes = epee_encoding::to_bytes(fluffy_block.clone()).unwrap();
|
||||
let fluffy_block_2: NewFluffyBlock = epee_encoding::from_bytes(&mut encoded_bytes).unwrap();
|
||||
let mut encoded_bytes = cuprate_epee_encoding::to_bytes(fluffy_block.clone()).unwrap();
|
||||
let fluffy_block_2: NewFluffyBlock =
|
||||
cuprate_epee_encoding::from_bytes(&mut encoded_bytes).unwrap();
|
||||
|
||||
assert_eq!(fluffy_block, fluffy_block_2);
|
||||
}
|
||||
|
|
|
@ -19,13 +19,13 @@ use tokio::{
|
|||
use tokio_util::time::DelayQueue;
|
||||
use tower::Service;
|
||||
|
||||
use monero_p2p::{
|
||||
use cuprate_p2p_core::{
|
||||
client::InternalPeerID,
|
||||
handles::ConnectionHandle,
|
||||
services::{AddressBookRequest, AddressBookResponse, ZoneSpecificPeerListEntryBase},
|
||||
NetZoneAddress, NetworkZone,
|
||||
};
|
||||
use monero_pruning::PruningSeed;
|
||||
use cuprate_pruning::PruningSeed;
|
||||
|
||||
use crate::{peer_list::PeerList, store::save_peers_to_disk, AddressBookConfig, AddressBookError};
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ use std::{path::PathBuf, sync::Arc, time::Duration};
|
|||
use futures::StreamExt;
|
||||
use tokio::{sync::Semaphore, time::interval};
|
||||
|
||||
use monero_p2p::handles::HandleBuilder;
|
||||
use monero_pruning::PruningSeed;
|
||||
use cuprate_p2p_core::handles::HandleBuilder;
|
||||
use cuprate_pruning::PruningSeed;
|
||||
|
||||
use super::{AddressBook, ConnectionPeerEntry, InternalPeerID};
|
||||
use crate::{peer_list::tests::make_fake_peer_list, AddressBookConfig, AddressBookError};
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//!
|
||||
use std::{io::ErrorKind, path::PathBuf, time::Duration};
|
||||
|
||||
use monero_p2p::NetworkZone;
|
||||
use cuprate_p2p_core::NetworkZone;
|
||||
|
||||
mod book;
|
||||
mod peer_list;
|
||||
|
|
|
@ -3,8 +3,8 @@ use std::collections::{BTreeMap, HashMap, HashSet};
|
|||
use indexmap::IndexMap;
|
||||
use rand::prelude::*;
|
||||
|
||||
use monero_p2p::{services::ZoneSpecificPeerListEntryBase, NetZoneAddress, NetworkZone};
|
||||
use monero_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT};
|
||||
use cuprate_p2p_core::{services::ZoneSpecificPeerListEntryBase, NetZoneAddress, NetworkZone};
|
||||
use cuprate_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT};
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests;
|
||||
|
|
|
@ -2,11 +2,9 @@ use std::collections::HashSet;
|
|||
|
||||
use rand::Rng;
|
||||
|
||||
use monero_p2p::services::ZoneSpecificPeerListEntryBase;
|
||||
use monero_pruning::PruningSeed;
|
||||
|
||||
use cuprate_p2p_core::{services::ZoneSpecificPeerListEntryBase, NetZoneAddress};
|
||||
use cuprate_pruning::PruningSeed;
|
||||
use cuprate_test_utils::test_netzone::{TestNetZone, TestNetZoneAddr};
|
||||
use monero_p2p::NetZoneAddress;
|
||||
|
||||
use super::PeerList;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::fs;
|
|||
use borsh::{from_slice, to_vec, BorshDeserialize, BorshSerialize};
|
||||
use tokio::task::{spawn_blocking, JoinHandle};
|
||||
|
||||
use monero_p2p::{services::ZoneSpecificPeerListEntryBase, NetZoneAddress, NetworkZone};
|
||||
use cuprate_p2p_core::{services::ZoneSpecificPeerListEntryBase, NetZoneAddress, NetworkZone};
|
||||
|
||||
use crate::{peer_list::PeerList, AddressBookConfig};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use futures::{FutureExt, StreamExt};
|
||||
|
||||
use async_buffer::new_buffer;
|
||||
use cuprate_async_buffer::new_buffer;
|
||||
|
||||
#[tokio::test]
|
||||
async fn async_buffer_send_rec() {
|
||||
|
|
|
@ -25,8 +25,8 @@ pub mod handshaker;
|
|||
mod timeout_monitor;
|
||||
|
||||
pub use connector::{ConnectRequest, Connector};
|
||||
use cuprate_pruning::PruningSeed;
|
||||
pub use handshaker::{DoHandshakeRequest, HandShaker, HandshakeError};
|
||||
use monero_pruning::PruningSeed;
|
||||
|
||||
/// An internal identifier for a given peer, will be their address if known
|
||||
/// or a random u128 if not.
|
||||
|
|
|
@ -17,7 +17,7 @@ use tokio::{
|
|||
use tokio_stream::wrappers::ReceiverStream;
|
||||
use tower::ServiceExt;
|
||||
|
||||
use monero_wire::{LevinCommand, Message, ProtocolMessage};
|
||||
use cuprate_wire::{LevinCommand, Message, ProtocolMessage};
|
||||
|
||||
use crate::{
|
||||
constants::{REQUEST_TIMEOUT, SENDING_TIMEOUT},
|
||||
|
@ -241,7 +241,7 @@ where
|
|||
/// The main-loop for when we are in [`State::WaitingForRequest`].
|
||||
async fn state_waiting_for_request<Str>(&mut self, stream: &mut Str) -> Result<(), PeerError>
|
||||
where
|
||||
Str: FusedStream<Item = Result<Message, monero_wire::BucketError>> + Unpin,
|
||||
Str: FusedStream<Item = Result<Message, cuprate_wire::BucketError>> + Unpin,
|
||||
{
|
||||
tracing::debug!("waiting for peer/client request.");
|
||||
|
||||
|
@ -274,7 +274,7 @@ where
|
|||
/// The main-loop for when we are in [`State::WaitingForResponse`].
|
||||
async fn state_waiting_for_response<Str>(&mut self, stream: &mut Str) -> Result<(), PeerError>
|
||||
where
|
||||
Str: FusedStream<Item = Result<Message, monero_wire::BucketError>> + Unpin,
|
||||
Str: FusedStream<Item = Result<Message, cuprate_wire::BucketError>> + Unpin,
|
||||
{
|
||||
tracing::debug!("waiting for peer response.");
|
||||
|
||||
|
@ -306,7 +306,7 @@ where
|
|||
/// `eager_protocol_messages` are protocol messages that we received during a handshake.
|
||||
pub async fn run<Str>(mut self, mut stream: Str, eager_protocol_messages: Vec<ProtocolMessage>)
|
||||
where
|
||||
Str: FusedStream<Item = Result<Message, monero_wire::BucketError>> + Unpin,
|
||||
Str: FusedStream<Item = Result<Message, cuprate_wire::BucketError>> + Unpin,
|
||||
{
|
||||
tracing::debug!(
|
||||
"Handling eager messages len: {}",
|
||||
|
|
|
@ -20,8 +20,8 @@ use tokio::{
|
|||
use tower::{Service, ServiceExt};
|
||||
use tracing::{info_span, Instrument};
|
||||
|
||||
use monero_pruning::{PruningError, PruningSeed};
|
||||
use monero_wire::{
|
||||
use cuprate_pruning::{PruningError, PruningSeed};
|
||||
use cuprate_wire::{
|
||||
admin::{
|
||||
HandshakeRequest, HandshakeResponse, PingResponse, SupportFlagsResponse,
|
||||
PING_OK_RESPONSE_STATUS_TEXT,
|
||||
|
@ -586,7 +586,7 @@ async fn wait_for_message<Z: NetworkZone>(
|
|||
peer_sink: &mut Z::Sink,
|
||||
peer_stream: &mut Z::Stream,
|
||||
|
||||
eager_protocol_messages: &mut Vec<monero_wire::ProtocolMessage>,
|
||||
eager_protocol_messages: &mut Vec<cuprate_wire::ProtocolMessage>,
|
||||
|
||||
our_basic_node_data: &BasicNodeData,
|
||||
) -> Result<Message, HandshakeError> {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
//! sure the connection is still active.
|
||||
use std::sync::Arc;
|
||||
|
||||
use cuprate_wire::admin::TimedSyncRequest;
|
||||
use futures::channel::oneshot;
|
||||
use monero_wire::admin::TimedSyncRequest;
|
||||
use tokio::{
|
||||
sync::{mpsc, Semaphore},
|
||||
time::{interval, MissedTickBehavior},
|
||||
|
|
|
@ -45,7 +45,7 @@ pub enum PeerError {
|
|||
#[error("inner service error: {0}")]
|
||||
ServiceError(#[from] tower::BoxError),
|
||||
#[error("bucket error: {0}")]
|
||||
BucketError(#[from] monero_wire::BucketError),
|
||||
BucketError(#[from] cuprate_wire::BucketError),
|
||||
#[error("handshake error: {0}")]
|
||||
Handshake(#[from] crate::client::HandshakeError),
|
||||
#[error("i/o error: {0}")]
|
||||
|
|
|
@ -16,7 +16,7 @@ use std::{fmt::Debug, future::Future, hash::Hash, pin::Pin};
|
|||
|
||||
use futures::{Sink, Stream};
|
||||
|
||||
use monero_wire::{
|
||||
use cuprate_wire::{
|
||||
levin::LevinMessage, network_address::NetworkAddressIncorrectZone, BucketError, Message,
|
||||
NetworkAddress,
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ use tokio::net::{
|
|||
};
|
||||
use tokio_util::codec::{FramedRead, FramedWrite};
|
||||
|
||||
use monero_wire::MoneroWireCodec;
|
||||
use cuprate_wire::MoneroWireCodec;
|
||||
|
||||
use crate::{NetZoneAddress, NetworkZone};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
//! Request: NewFluffyBlock, Response: None,
|
||||
//! Request: NewTransactions, Response: None
|
||||
//!
|
||||
use monero_wire::{
|
||||
use cuprate_wire::{
|
||||
admin::{
|
||||
HandshakeRequest, HandshakeResponse, PingResponse, SupportFlagsResponse, TimedSyncRequest,
|
||||
TimedSyncResponse,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! This module contains the implementations of [`TryFrom`] and [`From`] to convert between
|
||||
//! [`Message`], [`PeerRequest`] and [`PeerResponse`].
|
||||
|
||||
use monero_wire::{Message, ProtocolMessage, RequestMessage, ResponseMessage};
|
||||
use cuprate_wire::{Message, ProtocolMessage, RequestMessage, ResponseMessage};
|
||||
|
||||
use super::{PeerRequest, PeerResponse};
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use monero_pruning::{PruningError, PruningSeed};
|
||||
use monero_wire::{CoreSyncData, PeerListEntryBase};
|
||||
use cuprate_pruning::{PruningError, PruningSeed};
|
||||
use cuprate_wire::{CoreSyncData, PeerListEntryBase};
|
||||
|
||||
use crate::{
|
||||
client::InternalPeerID, handles::ConnectionHandle, NetZoneAddress, NetworkAddressIncorrectZone,
|
||||
|
@ -44,7 +44,7 @@ pub struct ZoneSpecificPeerListEntryBase<A: NetZoneAddress> {
|
|||
pub rpc_credits_per_hash: u32,
|
||||
}
|
||||
|
||||
impl<A: NetZoneAddress> From<ZoneSpecificPeerListEntryBase<A>> for monero_wire::PeerListEntryBase {
|
||||
impl<A: NetZoneAddress> From<ZoneSpecificPeerListEntryBase<A>> for cuprate_wire::PeerListEntryBase {
|
||||
fn from(value: ZoneSpecificPeerListEntryBase<A>) -> Self {
|
||||
Self {
|
||||
adr: value.adr.into(),
|
||||
|
@ -65,7 +65,7 @@ pub enum PeerListConversionError {
|
|||
PruningSeed(#[from] PruningError),
|
||||
}
|
||||
|
||||
impl<A: NetZoneAddress> TryFrom<monero_wire::PeerListEntryBase>
|
||||
impl<A: NetZoneAddress> TryFrom<cuprate_wire::PeerListEntryBase>
|
||||
for ZoneSpecificPeerListEntryBase<A>
|
||||
{
|
||||
type Error = PeerListConversionError;
|
||||
|
|
|
@ -23,12 +23,12 @@ use tokio_util::{
|
|||
use tower::{Service, ServiceExt};
|
||||
|
||||
use cuprate_helper::network::Network;
|
||||
use monero_p2p::{
|
||||
use cuprate_p2p_core::{
|
||||
client::{ConnectRequest, Connector, DoHandshakeRequest, HandShaker, InternalPeerID},
|
||||
network_zones::ClearNetServerCfg,
|
||||
ConnectionDirection, NetworkZone,
|
||||
};
|
||||
use monero_wire::{
|
||||
use cuprate_wire::{
|
||||
common::PeerSupportFlags,
|
||||
levin::{message::make_fragmented_messages, LevinMessage, Protocol},
|
||||
BasicNodeData, Message, MoneroWireCodec,
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::{sync::Arc, time::Duration};
|
|||
|
||||
use tokio::sync::Semaphore;
|
||||
|
||||
use monero_p2p::handles::HandleBuilder;
|
||||
use cuprate_p2p_core::handles::HandleBuilder;
|
||||
|
||||
#[test]
|
||||
fn send_ban_signal() {
|
||||
|
|
|
@ -10,9 +10,9 @@ use tokio_util::codec::{FramedRead, FramedWrite};
|
|||
use tower::{Service, ServiceExt};
|
||||
|
||||
use cuprate_helper::network::Network;
|
||||
use monero_wire::{common::PeerSupportFlags, BasicNodeData, MoneroWireCodec};
|
||||
use cuprate_wire::{common::PeerSupportFlags, BasicNodeData, MoneroWireCodec};
|
||||
|
||||
use monero_p2p::{
|
||||
use cuprate_p2p_core::{
|
||||
client::{ConnectRequest, Connector, DoHandshakeRequest, HandShaker, InternalPeerID},
|
||||
network_zones::{ClearNet, ClearNetServerCfg},
|
||||
ConnectionDirection, NetworkZone,
|
||||
|
|
|
@ -4,9 +4,9 @@ use tokio::sync::Semaphore;
|
|||
use tower::{Service, ServiceExt};
|
||||
|
||||
use cuprate_helper::network::Network;
|
||||
use monero_wire::{common::PeerSupportFlags, protocol::GetObjectsRequest, BasicNodeData};
|
||||
use cuprate_wire::{common::PeerSupportFlags, protocol::GetObjectsRequest, BasicNodeData};
|
||||
|
||||
use monero_p2p::{
|
||||
use cuprate_p2p_core::{
|
||||
client::{ConnectRequest, Connector, HandShaker},
|
||||
network_zones::ClearNet,
|
||||
protocol::{PeerRequest, PeerResponse},
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::{
|
|||
use futures::FutureExt;
|
||||
use tower::Service;
|
||||
|
||||
use monero_p2p::{
|
||||
use cuprate_p2p_core::{
|
||||
services::{
|
||||
AddressBookRequest, AddressBookResponse, CoreSyncDataRequest, CoreSyncDataResponse,
|
||||
PeerSyncRequest, PeerSyncResponse,
|
||||
|
@ -54,7 +54,7 @@ impl Service<CoreSyncDataRequest> for DummyCoreSyncSvc {
|
|||
|
||||
fn call(&mut self, _: CoreSyncDataRequest) -> Self::Future {
|
||||
async move {
|
||||
Ok(CoreSyncDataResponse(monero_wire::CoreSyncData {
|
||||
Ok(CoreSyncDataResponse(cuprate_wire::CoreSyncData {
|
||||
cumulative_difficulty: 1,
|
||||
cumulative_difficulty_top64: 0,
|
||||
current_height: 1,
|
||||
|
|
|
@ -22,8 +22,10 @@ use tokio::{
|
|||
use tokio_stream::wrappers::WatchStream;
|
||||
use tower::Service;
|
||||
|
||||
use monero_p2p::{client::InternalPeerID, BroadcastMessage, ConnectionDirection, NetworkZone};
|
||||
use monero_wire::{
|
||||
use cuprate_p2p_core::{
|
||||
client::InternalPeerID, BroadcastMessage, ConnectionDirection, NetworkZone,
|
||||
};
|
||||
use cuprate_wire::{
|
||||
common::{BlockCompleteEntry, TransactionBlobs},
|
||||
protocol::{NewFluffyBlock, NewTransactions},
|
||||
};
|
||||
|
@ -128,7 +130,7 @@ pub fn init_broadcast_channels<N: NetworkZone>(
|
|||
/// Only certain P2P messages are supported here: [`NewFluffyBlock`] and [`NewTransactions`]. These are the only
|
||||
/// P2P messages that make sense to broadcast to multiple peers.
|
||||
///
|
||||
/// [`NewBlock`](monero_wire::protocol::NewBlock) has been excluded as monerod has had fluffy blocks for a while and
|
||||
/// [`NewBlock`](cuprate_wire::protocol::NewBlock) has been excluded as monerod has had fluffy blocks for a while and
|
||||
/// Cuprate sets fluffy blocks as a requirement during handshakes.
|
||||
pub enum BroadcastRequest<N: NetworkZone> {
|
||||
/// Broadcast a block to the network. The block will be broadcast as a fluffy block to all peers.
|
||||
|
@ -400,8 +402,8 @@ mod tests {
|
|||
use tokio::time::timeout;
|
||||
use tower::{Service, ServiceExt};
|
||||
|
||||
use cuprate_p2p_core::{client::InternalPeerID, BroadcastMessage, ConnectionDirection};
|
||||
use cuprate_test_utils::test_netzone::TestNetZone;
|
||||
use monero_p2p::{client::InternalPeerID, BroadcastMessage, ConnectionDirection};
|
||||
|
||||
use super::{init_broadcast_channels, BroadcastConfig, BroadcastRequest};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ use dashmap::DashMap;
|
|||
use tokio::sync::mpsc;
|
||||
use tracing::{Instrument, Span};
|
||||
|
||||
use monero_p2p::{
|
||||
use cuprate_p2p_core::{
|
||||
client::{Client, InternalPeerID},
|
||||
handles::ConnectionHandle,
|
||||
NetworkZone,
|
||||
|
|
|
@ -14,7 +14,7 @@ use tokio::sync::mpsc;
|
|||
use tokio_util::sync::WaitForCancellationFutureOwned;
|
||||
use tracing::instrument;
|
||||
|
||||
use monero_p2p::{client::InternalPeerID, handles::ConnectionHandle, NetworkZone};
|
||||
use cuprate_p2p_core::{client::InternalPeerID, handles::ConnectionHandle, NetworkZone};
|
||||
|
||||
use super::ClientPool;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
|
||||
use monero_p2p::{client::Client, NetworkZone};
|
||||
use cuprate_p2p_core::{client::Client, NetworkZone};
|
||||
|
||||
use crate::client_pool::ClientPool;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use cuprate_address_book::AddressBookConfig;
|
||||
use cuprate_helper::network::Network;
|
||||
use monero_address_book::AddressBookConfig;
|
||||
use monero_p2p::NetworkZone;
|
||||
use monero_wire::{common::PeerSupportFlags, BasicNodeData};
|
||||
use cuprate_p2p_core::NetworkZone;
|
||||
use cuprate_wire::{common::PeerSupportFlags, BasicNodeData};
|
||||
|
||||
/// P2P config.
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
@ -14,7 +14,7 @@ use tokio::{
|
|||
use tower::{Service, ServiceExt};
|
||||
use tracing::{instrument, Instrument, Span};
|
||||
|
||||
use monero_p2p::{
|
||||
use cuprate_p2p_core::{
|
||||
client::{Client, ConnectRequest, HandshakeError},
|
||||
services::{AddressBookRequest, AddressBookResponse},
|
||||
AddressBook, NetworkZone,
|
||||
|
|
|
@ -12,7 +12,7 @@ use tokio::{
|
|||
use tower::{Service, ServiceExt};
|
||||
use tracing::{instrument, Instrument, Span};
|
||||
|
||||
use monero_p2p::{
|
||||
use cuprate_p2p_core::{
|
||||
client::{Client, DoHandshakeRequest, HandshakeError, InternalPeerID},
|
||||
services::{AddressBookRequest, AddressBookResponse},
|
||||
AddressBook, ConnectionDirection, NetworkZone,
|
||||
|
|
|
@ -13,7 +13,7 @@ use tokio_stream::wrappers::WatchStream;
|
|||
use tower::{buffer::Buffer, util::BoxCloneService, ServiceExt};
|
||||
use tracing::{instrument, Instrument, Span};
|
||||
|
||||
use monero_p2p::{
|
||||
use cuprate_p2p_core::{
|
||||
client::Connector,
|
||||
client::InternalPeerID,
|
||||
services::{AddressBookRequest, AddressBookResponse},
|
||||
|
@ -53,7 +53,7 @@ where
|
|||
CS: CoreSyncSvc + Clone,
|
||||
{
|
||||
let address_book =
|
||||
monero_address_book::init_address_book(config.address_book_config.clone()).await?;
|
||||
cuprate_address_book::init_address_book(config.address_book_config.clone()).await?;
|
||||
let address_book = Buffer::new(
|
||||
address_book,
|
||||
config.max_inbound_connections + config.outbound_connections,
|
||||
|
@ -76,7 +76,7 @@ where
|
|||
basic_node_data.peer_id = 1;
|
||||
}
|
||||
|
||||
let outbound_handshaker = monero_p2p::client::HandShaker::new(
|
||||
let outbound_handshaker = cuprate_p2p_core::client::HandShaker::new(
|
||||
address_book.clone(),
|
||||
sync_states_svc.clone(),
|
||||
core_sync_svc.clone(),
|
||||
|
@ -85,7 +85,7 @@ where
|
|||
basic_node_data.clone(),
|
||||
);
|
||||
|
||||
let inbound_handshaker = monero_p2p::client::HandShaker::new(
|
||||
let inbound_handshaker = cuprate_p2p_core::client::HandShaker::new(
|
||||
address_book.clone(),
|
||||
sync_states_svc,
|
||||
core_sync_svc.clone(),
|
||||
|
|
|
@ -13,14 +13,14 @@ use futures::{stream::FuturesUnordered, StreamExt};
|
|||
use tokio::sync::watch;
|
||||
use tower::Service;
|
||||
|
||||
use monero_p2p::{
|
||||
use cuprate_p2p_core::{
|
||||
client::InternalPeerID,
|
||||
handles::ConnectionHandle,
|
||||
services::{PeerSyncRequest, PeerSyncResponse},
|
||||
NetworkZone,
|
||||
};
|
||||
use monero_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT};
|
||||
use monero_wire::CoreSyncData;
|
||||
use cuprate_pruning::{PruningSeed, CRYPTONOTE_MAX_BLOCK_HEIGHT};
|
||||
use cuprate_wire::CoreSyncData;
|
||||
|
||||
use crate::{client_pool::disconnect_monitor::PeerDisconnectFut, constants::SHORT_BAN};
|
||||
|
||||
|
@ -243,11 +243,13 @@ mod tests {
|
|||
use tokio::sync::Semaphore;
|
||||
use tower::{Service, ServiceExt};
|
||||
|
||||
use monero_p2p::{client::InternalPeerID, handles::HandleBuilder, services::PeerSyncRequest};
|
||||
use monero_wire::CoreSyncData;
|
||||
use cuprate_p2p_core::{
|
||||
client::InternalPeerID, handles::HandleBuilder, services::PeerSyncRequest,
|
||||
};
|
||||
use cuprate_wire::CoreSyncData;
|
||||
|
||||
use cuprate_p2p_core::services::PeerSyncResponse;
|
||||
use cuprate_test_utils::test_netzone::TestNetZone;
|
||||
use monero_p2p::services::PeerSyncResponse;
|
||||
|
||||
use super::PeerSyncSvc;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//! SOMEDAY: the database `properties` table is not yet implemented.
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Import
|
||||
use monero_pruning::PruningSeed;
|
||||
use cuprate_pruning::PruningSeed;
|
||||
|
||||
use crate::{error::RuntimeError, ops::macros::doc_error};
|
||||
//---------------------------------------------------------------------------------------------------- Free Functions
|
||||
|
|
|
@ -15,12 +15,12 @@ use futures::Stream;
|
|||
use tokio::io::{DuplexStream, ReadHalf, WriteHalf};
|
||||
use tokio_util::codec::{FramedRead, FramedWrite};
|
||||
|
||||
use monero_wire::{
|
||||
use cuprate_wire::{
|
||||
network_address::{NetworkAddress, NetworkAddressIncorrectZone},
|
||||
MoneroWireCodec,
|
||||
};
|
||||
|
||||
use monero_p2p::{NetZoneAddress, NetworkZone};
|
||||
use cuprate_p2p_core::{NetZoneAddress, NetworkZone};
|
||||
|
||||
/// An address on the test network
|
||||
#[derive(Debug, Clone, Copy, Eq, Hash, PartialEq, BorshSerialize, BorshDeserialize)]
|
||||
|
|
Loading…
Reference in a new issue