Browse Source

Merge #253

253: A few fixes r=bonomat a=bonomat

A few fixes

Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
Co-authored-by: Lucas Soriano del Pino <l.soriano.del.pino@gmail.com>
compile-for-aarch64
bors[bot] 3 years ago
committed by GitHub
parent
commit
e7b4ee73dc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      cfd_protocol/tests/cfds.rs
  2. 3
      daemon/src/model/cfd.rs
  3. 6
      daemon/src/taker.rs

10
cfd_protocol/tests/cfds.rs

@ -1043,14 +1043,8 @@ impl OliviaData {
)
}
/// An example of all the data necessary from `olivia` to test the
/// CFD protocol.
///
/// Data comes from this event:
/// https://outcome.observer/h00.ooo/x/BitMEX/BXBT/2021-10-05T02:00:00.price?n=20.
///
/// Note: Due to removal of historic data these events cannot actually be retrieved from the
/// Oracle anymore.
/// Generate an example of all the data from `olivia` needed to test the
/// CFD protocol end-to-end.
fn example(id: &str, price: u64, nonce_pks: &[&str], attestations: &[&str]) -> Self {
let oracle_pk = schnorrsig::PublicKey::from_str(Self::OLIVIA_PK).unwrap();

3
daemon/src/model/cfd.rs

@ -154,8 +154,7 @@ fn calculate_liquidation_price(
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum Error {
// TODO
ConnectionLost,
Connect,
}
#[derive(Debug, Clone, Serialize, Deserialize)]

6
daemon/src/taker.rs

@ -53,9 +53,9 @@ pub struct Db(sqlx::SqlitePool);
#[derive(Clap)]
struct Opts {
/// The IP address of the taker to connect to.
/// The IP address of the other party (i.e. the maker).
#[clap(long, default_value = "127.0.0.1:9999")]
taker: SocketAddr,
maker: SocketAddr,
/// The port to listen on for the HTTP API.
#[clap(long, default_value = "8000")]
@ -155,7 +155,7 @@ async fn main() -> Result<()> {
let (read, write) = loop {
let socket = tokio::net::TcpSocket::new_v4()?;
if let Ok(connection) = socket.connect(opts.taker).await {
if let Ok(connection) = socket.connect(opts.maker).await {
break connection.into_split();
} else {
tracing::warn!(

Loading…
Cancel
Save