Skip to content
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

Derive Clone for SURB #93

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions src/header/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ pub mod routing;
// 32 represents size of a MontgomeryPoint on Curve25519
pub const HEADER_SIZE: usize = 32 + HEADER_INTEGRITY_MAC_SIZE + ENCRYPTED_ROUTING_INFO_SIZE;

#[derive(Debug)]
#[cfg_attr(test, derive(Clone))]
#[derive(Debug, Clone)]
pub struct SphinxHeader {
pub shared_secret: SharedSecret,
pub routing_info: EncapsulatedRoutingInformation,
}

#[derive(Clone)]
pub enum ProcessedHeader {
ForwardHop(Box<SphinxHeader>, NodeAddressBytes, Delay, PayloadKey),
FinalHop(DestinationAddressBytes, SURBIdentifier, PayloadKey),
Expand Down
2 changes: 1 addition & 1 deletion src/header/routing/destination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl FinalRoutingInformation {
// return D || I || PAD
PaddedFinalRoutingInformation {
value: std::iter::once(self.flag)
.chain(self.version.to_bytes().into_iter())
.chain(self.version.to_bytes())
.chain(self.destination.as_bytes().iter().cloned())
.chain(self.identifier.iter().cloned())
.chain(padding.iter().cloned())
Expand Down
2 changes: 1 addition & 1 deletion src/header/routing/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl RoutingInformation {
.chain(self.version.to_bytes().iter().cloned())
.chain(self.node_address.as_bytes_ref().iter().cloned())
.chain(self.delay.to_bytes().iter().cloned())
.chain(self.header_integrity_mac.into_inner().into_iter())
.chain(self.header_integrity_mac.into_inner())
.chain(self.next_routing_information.iter().cloned())
.collect()
}
Expand Down
1 change: 1 addition & 0 deletions src/surb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::fmt;
/// the address of the first hop in the route of the SURB, and the key material
/// used to layer encrypt the payload.
#[allow(non_snake_case)]
#[derive(Clone)]
pub struct SURB {
SURB_header: header::SphinxHeader,
first_hop_address: NodeAddressBytes,
Expand Down
Loading