Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Commit 5813064

Browse files
Merge #732
732: Update for cnd 0.8.0 r=thomaseizinger a=thomaseizinger Co-authored-by: Thomas Eizinger <[email protected]>
2 parents 5d72a1a + 1ce5310 commit 5813064

File tree

3 files changed

+49
-20
lines changed

3 files changed

+49
-20
lines changed

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.41.1
1+
1.44.0

scripts/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## Unreleased
88

9+
## Changed
10+
- Update cnd to version 0.8.0
11+
912
## [0.8.3] - 2020-01-31
1013

1114
### Fixed

scripts/src/docker/cnd.rs

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ use crate::docker::{
1010
self, docker_daemon_ip, free_local_port::free_local_port, DockerImage, File, LogMessage,
1111
DOCKER_NETWORK,
1212
};
13+
use serde::Serializer;
1314

14-
const IMAGE: &str = "comitnetwork/cnd:0.4.0";
15+
const IMAGE: &str = "comitnetwork/cnd:0.8.0";
1516

1617
#[derive(derive_more::Display, Copy, Clone)]
1718
#[display(fmt = "http://{}:{}", ip, port)]
@@ -25,17 +26,7 @@ pub struct CndInstance {
2526
}
2627

2728
pub async fn new_instance(index: u32) -> anyhow::Result<CndInstance> {
28-
let settings = Settings {
29-
bitcoin: Bitcoin {
30-
network: String::from("regtest"),
31-
node_url: "http://bitcoin:18443".to_string(),
32-
},
33-
ethereum: Ethereum {
34-
chain_id: 17,
35-
node_url: "http://ethereum:8545".to_string(),
36-
},
37-
..Default::default()
38-
};
29+
let settings = Settings::default();
3930

4031
let settings = toml::to_string(&settings).context("failed to serialize settings")?;
4132

@@ -72,6 +63,7 @@ pub async fn new_instance(index: u32) -> anyhow::Result<CndInstance> {
7263
struct Settings {
7364
network: Network,
7465
http_api: HttpApi,
66+
data: Data,
7567
logging: Logging,
7668
bitcoin: Bitcoin,
7769
ethereum: Ethereum,
@@ -87,32 +79,55 @@ struct HttpApi {
8779
cors: Cors,
8880
}
8981

90-
#[derive(Clone, Debug, serde::Serialize)]
82+
#[derive(Clone, Debug)]
9183
struct Socket {
9284
address: IpAddr,
9385
port: u16,
9486
}
9587

88+
impl serde::Serialize for Socket {
89+
fn serialize<S>(&self, serializer: S) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
90+
where
91+
S: Serializer,
92+
{
93+
serializer.serialize_str(&format!("{}:{}", self.address.to_string(), self.port))
94+
}
95+
}
96+
9697
#[derive(Clone, Debug, serde::Serialize)]
9798
struct Cors {
9899
allowed_origins: String,
99100
}
100101

102+
#[derive(Clone, Debug, serde::Serialize)]
103+
struct Data {
104+
dir: String,
105+
}
106+
101107
#[derive(Clone, Debug, serde::Serialize)]
102108
struct Logging {
103109
level: String,
104-
structured: bool,
105110
}
106111

107112
#[derive(Clone, Debug, serde::Serialize)]
108113
struct Bitcoin {
109114
network: String,
115+
bitcoind: Bitcoind,
116+
}
117+
118+
#[derive(Clone, Debug, serde::Serialize)]
119+
struct Bitcoind {
110120
node_url: String,
111121
}
112122

113123
#[derive(Clone, Debug, serde::Serialize)]
114124
struct Ethereum {
115-
chain_id: i8,
125+
chain_id: i16,
126+
geth: Geth,
127+
}
128+
129+
#[derive(Clone, Debug, serde::Serialize)]
130+
struct Geth {
116131
node_url: String,
117132
}
118133

@@ -150,11 +165,18 @@ impl Default for Cors {
150165
}
151166
}
152167

168+
impl Default for Data {
169+
fn default() -> Self {
170+
Data {
171+
dir: "/home/cnd/.local/share/comit/".to_string(),
172+
}
173+
}
174+
}
175+
153176
impl Default for Logging {
154177
fn default() -> Self {
155178
Logging {
156-
level: "DEBUG".to_string(),
157-
structured: false,
179+
level: "Debug".to_string(),
158180
}
159181
}
160182
}
@@ -163,7 +185,9 @@ impl Default for Bitcoin {
163185
fn default() -> Self {
164186
Bitcoin {
165187
network: "regtest".to_string(),
166-
node_url: "http://localhost:18443".to_string(),
188+
bitcoind: Bitcoind {
189+
node_url: "http://bitcoin:18443".to_string(),
190+
},
167191
}
168192
}
169193
}
@@ -172,7 +196,9 @@ impl Default for Ethereum {
172196
fn default() -> Self {
173197
Ethereum {
174198
chain_id: 17,
175-
node_url: "http://localhost:8545".to_string(),
199+
geth: Geth {
200+
node_url: "http://ethereum:8545".to_string(),
201+
},
176202
}
177203
}
178204
}

0 commit comments

Comments
 (0)