mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Merge #1326
1326: chore: fix dprint config and run fmt r=delta1 a=delta1 Recent dprint changes broke the static analysis CI job See: https://github.com/dprint/dprint/issues/656 Co-authored-by: Byron Hambly <bhambly@blockstream.com>
This commit is contained in:
commit
4520c1f87c
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@ -15,6 +15,11 @@ jobs:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v3.3.0
|
||||
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: 1.63
|
||||
components: clippy,rustfmt
|
||||
|
||||
- uses: Swatinem/rust-cache@v2.2.1
|
||||
|
||||
- name: Check formatting
|
||||
|
16
dprint.json
16
dprint.json
@ -3,22 +3,16 @@
|
||||
"projectType": "openSource",
|
||||
"incremental": true,
|
||||
"markdown": {},
|
||||
"rustfmt": {
|
||||
"edition": 2021,
|
||||
"condense_wildcard_suffixes": true,
|
||||
"format_macro_matchers": true,
|
||||
"imports_granularity": "Module",
|
||||
"use_field_init_shorthand": true,
|
||||
"format_code_in_doc_comments": true,
|
||||
"normalize_comments": true,
|
||||
"wrap_comments": true,
|
||||
"overflow_delimited_expr": true
|
||||
"exec": {
|
||||
"associations": "**/*.{rs}",
|
||||
"rustfmt": "rustfmt --edition 2021",
|
||||
"rustfmt.associations": "**/*.rs"
|
||||
},
|
||||
"includes": ["**/*.{md}", "**/*.{toml}", "**/*.{rs}"],
|
||||
"excludes": ["target/"],
|
||||
"plugins": [
|
||||
"https://plugins.dprint.dev/markdown-0.13.1.wasm",
|
||||
"https://github.com/thomaseizinger/dprint-plugin-cargo-toml/releases/download/0.1.0/cargo-toml-0.1.0.wasm",
|
||||
"https://plugins.dprint.dev/rustfmt-0.6.1.exe-plugin@99b89a0599fd3a63e597e03436862157901f3facae2f0c2fbd0b9f656cdbc2a5"
|
||||
"https://plugins.dprint.dev/exec-0.3.5.json@d687dda57be0fe9a0088ccdaefa5147649ff24127d8b3ea227536c68ee7abeab"
|
||||
]
|
||||
}
|
||||
|
@ -47,9 +47,10 @@ impl Client {
|
||||
}
|
||||
|
||||
pub async fn get_o_indexes(&self, txid: Hash) -> Result<GetOIndexesResponse> {
|
||||
self.binary_request(self.get_o_indexes_bin_url.clone(), GetOIndexesPayload {
|
||||
txid,
|
||||
})
|
||||
self.binary_request(
|
||||
self.get_o_indexes_bin_url.clone(),
|
||||
GetOIndexesPayload { txid },
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
|
@ -210,14 +210,20 @@ impl TxCancel {
|
||||
};
|
||||
|
||||
// The order in which these are inserted doesn't matter
|
||||
satisfier.insert(A, ::bitcoin::EcdsaSig {
|
||||
sig: sig_a.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
});
|
||||
satisfier.insert(B, ::bitcoin::EcdsaSig {
|
||||
sig: sig_b.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
});
|
||||
satisfier.insert(
|
||||
A,
|
||||
::bitcoin::EcdsaSig {
|
||||
sig: sig_a.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
},
|
||||
);
|
||||
satisfier.insert(
|
||||
B,
|
||||
::bitcoin::EcdsaSig {
|
||||
sig: sig_b.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
},
|
||||
);
|
||||
|
||||
satisfier
|
||||
};
|
||||
|
@ -65,14 +65,20 @@ impl TxPunish {
|
||||
let B = B.try_into()?;
|
||||
|
||||
// The order in which these are inserted doesn't matter
|
||||
satisfier.insert(A, ::bitcoin::EcdsaSig {
|
||||
sig: sig_a.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
});
|
||||
satisfier.insert(B, ::bitcoin::EcdsaSig {
|
||||
sig: sig_b.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
});
|
||||
satisfier.insert(
|
||||
A,
|
||||
::bitcoin::EcdsaSig {
|
||||
sig: sig_a.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
},
|
||||
);
|
||||
satisfier.insert(
|
||||
B,
|
||||
::bitcoin::EcdsaSig {
|
||||
sig: sig_b.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
},
|
||||
);
|
||||
|
||||
satisfier
|
||||
};
|
||||
|
@ -87,14 +87,20 @@ impl TxRedeem {
|
||||
};
|
||||
|
||||
// The order in which these are inserted doesn't matter
|
||||
satisfier.insert(A, ::bitcoin::EcdsaSig {
|
||||
sig: sig_a.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
});
|
||||
satisfier.insert(B, ::bitcoin::EcdsaSig {
|
||||
sig: sig_b.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
});
|
||||
satisfier.insert(
|
||||
A,
|
||||
::bitcoin::EcdsaSig {
|
||||
sig: sig_a.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
},
|
||||
);
|
||||
satisfier.insert(
|
||||
B,
|
||||
::bitcoin::EcdsaSig {
|
||||
sig: sig_b.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
},
|
||||
);
|
||||
|
||||
satisfier
|
||||
};
|
||||
|
@ -70,14 +70,20 @@ impl TxRefund {
|
||||
};
|
||||
|
||||
// The order in which these are inserted doesn't matter
|
||||
satisfier.insert(A, ::bitcoin::EcdsaSig {
|
||||
sig: sig_a.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
});
|
||||
satisfier.insert(B, ::bitcoin::EcdsaSig {
|
||||
sig: sig_b.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
});
|
||||
satisfier.insert(
|
||||
A,
|
||||
::bitcoin::EcdsaSig {
|
||||
sig: sig_a.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
},
|
||||
);
|
||||
satisfier.insert(
|
||||
B,
|
||||
::bitcoin::EcdsaSig {
|
||||
sig: sig_b.into(),
|
||||
hash_ty: EcdsaSighashType::All,
|
||||
},
|
||||
);
|
||||
|
||||
satisfier
|
||||
};
|
||||
|
@ -350,23 +350,26 @@ mod tests {
|
||||
|
||||
list.sort();
|
||||
|
||||
assert_eq!(list, vec![
|
||||
Seller {
|
||||
multiaddr: "/ip4/127.0.0.1/tcp/5678".parse().unwrap(),
|
||||
status: Status::Online(BidQuote {
|
||||
price: Default::default(),
|
||||
min_quantity: Default::default(),
|
||||
max_quantity: Default::default(),
|
||||
})
|
||||
},
|
||||
Seller {
|
||||
multiaddr: Multiaddr::empty(),
|
||||
status: Status::Unreachable
|
||||
},
|
||||
Seller {
|
||||
multiaddr: "/ip4/127.0.0.1/tcp/1234".parse().unwrap(),
|
||||
status: Status::Unreachable
|
||||
},
|
||||
])
|
||||
assert_eq!(
|
||||
list,
|
||||
vec![
|
||||
Seller {
|
||||
multiaddr: "/ip4/127.0.0.1/tcp/5678".parse().unwrap(),
|
||||
status: Status::Online(BidQuote {
|
||||
price: Default::default(),
|
||||
min_quantity: Default::default(),
|
||||
max_quantity: Default::default(),
|
||||
})
|
||||
},
|
||||
Seller {
|
||||
multiaddr: Multiaddr::empty(),
|
||||
status: Status::Unreachable
|
||||
},
|
||||
Seller {
|
||||
multiaddr: "/ip4/127.0.0.1/tcp/1234".parse().unwrap(),
|
||||
status: Status::Unreachable
|
||||
},
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -155,13 +155,16 @@ impl ProtocolsHandler for Handler {
|
||||
let env_config = self.env_config;
|
||||
|
||||
let protocol = tokio::time::timeout(self.timeout, async move {
|
||||
write_cbor_message(&mut substream, SpotPriceRequest {
|
||||
btc: info.btc,
|
||||
blockchain_network: BlockchainNetwork {
|
||||
bitcoin: env_config.bitcoin_network,
|
||||
monero: env_config.monero_network,
|
||||
write_cbor_message(
|
||||
&mut substream,
|
||||
SpotPriceRequest {
|
||||
btc: info.btc,
|
||||
blockchain_network: BlockchainNetwork {
|
||||
bitcoin: env_config.bitcoin_network,
|
||||
monero: env_config.monero_network,
|
||||
},
|
||||
},
|
||||
})
|
||||
)
|
||||
.await?;
|
||||
|
||||
let xmr = Result::from(read_cbor_message::<SpotPriceResponse>(&mut substream).await?)?;
|
||||
|
@ -184,29 +184,32 @@ impl State0 {
|
||||
|
||||
let v = self.v_a + msg.v_b;
|
||||
|
||||
Ok((msg.swap_id, State1 {
|
||||
a: self.a,
|
||||
B: msg.B,
|
||||
s_a: self.s_a,
|
||||
S_a_monero: self.S_a_monero,
|
||||
S_a_bitcoin: self.S_a_bitcoin,
|
||||
S_b_monero: msg.S_b_monero,
|
||||
S_b_bitcoin: msg.S_b_bitcoin,
|
||||
v,
|
||||
v_a: self.v_a,
|
||||
dleq_proof_s_a: self.dleq_proof_s_a,
|
||||
btc: self.btc,
|
||||
xmr: self.xmr,
|
||||
cancel_timelock: self.cancel_timelock,
|
||||
punish_timelock: self.punish_timelock,
|
||||
refund_address: msg.refund_address,
|
||||
redeem_address: self.redeem_address,
|
||||
punish_address: self.punish_address,
|
||||
tx_redeem_fee: self.tx_redeem_fee,
|
||||
tx_punish_fee: self.tx_punish_fee,
|
||||
tx_refund_fee: msg.tx_refund_fee,
|
||||
tx_cancel_fee: msg.tx_cancel_fee,
|
||||
}))
|
||||
Ok((
|
||||
msg.swap_id,
|
||||
State1 {
|
||||
a: self.a,
|
||||
B: msg.B,
|
||||
s_a: self.s_a,
|
||||
S_a_monero: self.S_a_monero,
|
||||
S_a_bitcoin: self.S_a_bitcoin,
|
||||
S_b_monero: msg.S_b_monero,
|
||||
S_b_bitcoin: msg.S_b_bitcoin,
|
||||
v,
|
||||
v_a: self.v_a,
|
||||
dleq_proof_s_a: self.dleq_proof_s_a,
|
||||
btc: self.btc,
|
||||
xmr: self.xmr,
|
||||
cancel_timelock: self.cancel_timelock,
|
||||
punish_timelock: self.punish_timelock,
|
||||
refund_address: msg.refund_address,
|
||||
redeem_address: self.redeem_address,
|
||||
punish_address: self.punish_address,
|
||||
tx_redeem_fee: self.tx_redeem_fee,
|
||||
tx_punish_fee: self.tx_punish_fee,
|
||||
tx_refund_fee: msg.tx_refund_fee,
|
||||
tx_cancel_fee: msg.tx_cancel_fee,
|
||||
},
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,13 +158,16 @@ async fn init_containers(cli: &Cli) -> (Monero, Containers<'_>) {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
(monero, Containers {
|
||||
bitcoind_url,
|
||||
bitcoind,
|
||||
monerod_container,
|
||||
monero_wallet_rpc_containers,
|
||||
electrs,
|
||||
})
|
||||
(
|
||||
monero,
|
||||
Containers {
|
||||
bitcoind_url,
|
||||
bitcoind,
|
||||
monerod_container,
|
||||
monero_wallet_rpc_containers,
|
||||
electrs,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
async fn init_bitcoind_container(
|
||||
|
Loading…
Reference in New Issue
Block a user