Removed constructors only used in tests

To elaborate further, to update Mixnode constructor it would require adding yet two more arguments and at that point the compiler warns about too many arguments
This commit is contained in:
Jędrzej Stuczyński
2021-06-23 16:08:27 +01:00
parent 035ee3a402
commit 9df360cf63
3 changed files with 41 additions and 80 deletions
-22
View File
@@ -19,28 +19,6 @@ pub struct Gateway {
pub version: String,
}
impl Gateway {
pub fn new(
host: String,
mix_port: u16,
clients_port: u16,
location: String,
sphinx_key: SphinxKey,
identity_key: IdentityKey,
version: String,
) -> Self {
Gateway {
host,
mix_port,
clients_port,
location,
sphinx_key,
identity_key,
version,
}
}
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, JsonSchema)]
pub struct GatewayBond {
pub amount: Vec<Coin>,
-22
View File
@@ -21,28 +21,6 @@ pub struct MixNode {
pub version: String,
}
impl MixNode {
pub fn new(
host: String,
mix_port: u16,
layer: u64,
location: String,
sphinx_key: SphinxKey,
identity_key: IdentityKey,
version: String,
) -> Self {
MixNode {
host,
mix_port,
layer,
location,
sphinx_key,
identity_key,
version,
}
}
}
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize, JsonSchema)]
pub struct MixNodeBond {
// TODO:
+41 -36
View File
@@ -105,52 +105,57 @@ pub mod helpers {
}
pub fn mix_node_fixture() -> MixNode {
MixNode::new(
"mix.node.org".to_string(),
1789,
1,
"Sweden".to_string(),
"sphinx".to_string(),
"identity".to_string(),
"0.10.0".to_string(),
)
MixNode {
host: "mix.node.org".to_string(),
mix_port: 1789,
verloc_port: 1790,
http_api_port: 8000,
layer: 1,
location: "Sweden".to_string(),
sphinx_key: "sphinx".to_string(),
identity_key: "identity".to_string(),
version: "0.10.0".to_string(),
}
}
pub fn mixnode_bond_fixture() -> MixNodeBond {
let mix_node = MixNode::new(
"1.1.1.1".to_string(),
1789,
1,
"London".to_string(),
"1234".to_string(),
"aaaa".to_string(),
"0.10.0".to_string(),
);
let mix_node = MixNode {
host: "1.1.1.1".to_string(),
mix_port: 1789,
verloc_port: 1790,
http_api_port: 8000,
layer: 1,
location: "London".to_string(),
sphinx_key: "1234".to_string(),
identity_key: "aaaa".to_string(),
version: "0.10.0".to_string(),
};
MixNodeBond::new(coins(50, DENOM), Addr::unchecked("foo"), mix_node)
}
pub fn gateway_fixture() -> Gateway {
Gateway::new(
"1.1.1.1".to_string(),
1789,
9000,
"Sweden".to_string(),
"sphinx".to_string(),
"identity".to_string(),
"0.10.0".to_string(),
)
Gateway {
host: "1.1.1.1".to_string(),
mix_port: 1789,
clients_port: 9000,
location: "Sweden".to_string(),
sphinx_key: "sphinx".to_string(),
identity_key: "identity".to_string(),
version: "0.10.0".to_string(),
}
}
pub fn gateway_bond_fixture() -> GatewayBond {
let gateway = Gateway::new(
"1.1.1.1".to_string(),
1789,
9000,
"London".to_string(),
"sphinx".to_string(),
"identity".to_string(),
"0.10.0".to_string(),
);
let gateway = Gateway {
host: "1.1.1.1".to_string(),
mix_port: 1789,
clients_port: 9000,
location: "London".to_string(),
sphinx_key: "sphinx".to_string(),
identity_key: "identity".to_string(),
version: "0.10.0".to_string(),
};
GatewayBond::new(coins(50, DENOM), Addr::unchecked("foo"), gateway)
}