mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-02-21 23:29:50 -05:00
Update Rust toolchain to get cargo fmt back
This commit is contained in:
parent
07dd12abf6
commit
642f1d8318
@ -71,10 +71,9 @@ impl Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_o_indexes(&self, txid: Hash) -> Result<GetOIndexesResponse> {
|
pub async fn get_o_indexes(&self, txid: Hash) -> Result<GetOIndexesResponse> {
|
||||||
self.binary_request(
|
self.binary_request(self.get_o_indexes_bin_url.clone(), GetOIndexesPayload {
|
||||||
self.get_o_indexes_bin_url.clone(),
|
txid,
|
||||||
GetOIndexesPayload { txid },
|
})
|
||||||
)
|
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,8 @@ impl ConfidentialTransactionBuilder {
|
|||||||
input_commitment: input_to_spend.commitment().unwrap(), // TODO: Error handling
|
input_commitment: input_to_spend.commitment().unwrap(), // TODO: Error handling
|
||||||
spend_amount: input_to_spend.amount().unwrap(), // TODO: Error handling,
|
spend_amount: input_to_spend.amount().unwrap(), // TODO: Error handling,
|
||||||
global_output_index,
|
global_output_index,
|
||||||
real_commitment_blinder: input_to_spend.blinding_factor().unwrap(), // TODO: Error handling
|
real_commitment_blinder: input_to_spend.blinding_factor().unwrap(), /* TODO: Error
|
||||||
|
* handling */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,7 +313,8 @@ impl CalculateKeyOffsetBoundaries for monerod::Client {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.max()
|
.max()
|
||||||
.context("Expected at least one output index")?;
|
.context("Expected at least one output index")?;
|
||||||
// let oldest_index = last_index - (last_index / 100) * 40; // oldest index must be within last 40% TODO: CONFIRM THIS
|
// let oldest_index = last_index - (last_index / 100) * 40; // oldest index must
|
||||||
|
// be within last 40% TODO: CONFIRM THIS
|
||||||
|
|
||||||
Ok((VarInt(0), VarInt(last_index)))
|
Ok((VarInt(0), VarInt(last_index)))
|
||||||
}
|
}
|
||||||
@ -340,7 +342,8 @@ impl FetchDecoyInputs for monerod::Client {
|
|||||||
.map(|(out_key, index)| {
|
.map(|(out_key, index)| {
|
||||||
DecoyInput {
|
DecoyInput {
|
||||||
global_output_index: *index,
|
global_output_index: *index,
|
||||||
key: out_key.key.point.decompress().unwrap(), // TODO: should decompress on deserialization
|
key: out_key.key.point.decompress().unwrap(), /* TODO: should decompress on
|
||||||
|
* deserialization */
|
||||||
commitment: CompressedEdwardsY(out_key.mask.key).decompress().unwrap(),
|
commitment: CompressedEdwardsY(out_key.mask.key).decompress().unwrap(),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -378,22 +381,19 @@ mod tests {
|
|||||||
|
|
||||||
let relative_offsets = to_relative_offsets(&key_offsets);
|
let relative_offsets = to_relative_offsets(&key_offsets);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(&relative_offsets, &[
|
||||||
&relative_offsets,
|
VarInt(78),
|
||||||
&[
|
VarInt(3),
|
||||||
VarInt(78),
|
VarInt(10),
|
||||||
VarInt(3),
|
VarInt(0),
|
||||||
VarInt(10),
|
VarInt(5),
|
||||||
VarInt(0),
|
VarInt(2),
|
||||||
VarInt(5),
|
VarInt(3),
|
||||||
VarInt(2),
|
VarInt(11),
|
||||||
VarInt(3),
|
VarInt(1),
|
||||||
VarInt(11),
|
VarInt(1),
|
||||||
VarInt(1),
|
VarInt(3),
|
||||||
VarInt(1),
|
])
|
||||||
VarInt(3),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -9,7 +9,10 @@ pub struct EmptyTransaction {}
|
|||||||
|
|
||||||
impl EmptyTransaction {
|
impl EmptyTransaction {
|
||||||
// TODO: Need to validate that given index matches with tx pubkey and commitment
|
// TODO: Need to validate that given index matches with tx pubkey and commitment
|
||||||
pub fn spend_from(input: OwnedTxOut<'_>, global_output_index: u64) -> Result<InputAdded, MissingOpening> {
|
pub fn spend_from(
|
||||||
|
input: OwnedTxOut<'_>,
|
||||||
|
global_output_index: u64,
|
||||||
|
) -> Result<InputAdded, MissingOpening> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -19,7 +22,10 @@ pub struct MissingOpening; // The opening was missing from the TX
|
|||||||
pub struct InputAdded {}
|
pub struct InputAdded {}
|
||||||
|
|
||||||
impl InputAdded {
|
impl InputAdded {
|
||||||
pub fn with_decoys(self, decoys: [DecoyInput; 10]) -> Result<DecoyOffsetsAdded, DuplicateIndex> {
|
pub fn with_decoys(
|
||||||
|
self,
|
||||||
|
decoys: [DecoyInput; 10],
|
||||||
|
) -> Result<DecoyOffsetsAdded, DuplicateIndex> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +89,9 @@ impl OutputsBlinded {
|
|||||||
|
|
||||||
/// Signs the transaction.
|
/// Signs the transaction.
|
||||||
///
|
///
|
||||||
/// This function calls the CLSAG sign algorithm with a set of parameters that will work. This however, assumes the caller does not want to have control over these parameters.
|
/// This function calls the CLSAG sign algorithm with a set of parameters
|
||||||
|
/// that will work. This however, assumes the caller does not want to have
|
||||||
|
/// control over these parameters.
|
||||||
pub fn sign(self, keys: KeyPair, rng: &mut (impl RngCore + CryptoRng)) -> Transaction {
|
pub fn sign(self, keys: KeyPair, rng: &mut (impl RngCore + CryptoRng)) -> Transaction {
|
||||||
// TODO: Do we want a sign_recommended API in monero::clsag?
|
// TODO: Do we want a sign_recommended API in monero::clsag?
|
||||||
|
|
||||||
@ -92,8 +100,9 @@ impl OutputsBlinded {
|
|||||||
|
|
||||||
/// Use the given signature for the internal transaction.
|
/// Use the given signature for the internal transaction.
|
||||||
///
|
///
|
||||||
/// This function is useful if the caller wants to have full control over certain parameters such as responses, L, R or I.
|
/// This function is useful if the caller wants to have full control over
|
||||||
/// The provided signature will be validated to make sure it is correct.
|
/// certain parameters such as responses, L, R or I. The provided
|
||||||
|
/// signature will be validated to make sure it is correct.
|
||||||
pub fn with_signature(self, sig: Clsag) -> Result<Transaction, InvalidSignature> {
|
pub fn with_signature(self, sig: Clsag) -> Result<Transaction, InvalidSignature> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2021-05-04"
|
channel = "nightly-2021-05-18"
|
||||||
components = ["clippy"]
|
components = ["clippy"]
|
||||||
targets = ["armv7-unknown-linux-gnueabihf"]
|
targets = ["armv7-unknown-linux-gnueabihf"]
|
||||||
|
@ -165,28 +165,25 @@ impl State0 {
|
|||||||
|
|
||||||
let v = self.v_a + msg.v_b;
|
let v = self.v_a + msg.v_b;
|
||||||
|
|
||||||
Ok((
|
Ok((msg.swap_id, State1 {
|
||||||
msg.swap_id,
|
a: self.a,
|
||||||
State1 {
|
B: msg.B,
|
||||||
a: self.a,
|
s_a: self.s_a,
|
||||||
B: msg.B,
|
S_a_monero: self.S_a_monero,
|
||||||
s_a: self.s_a,
|
S_a_bitcoin: self.S_a_bitcoin,
|
||||||
S_a_monero: self.S_a_monero,
|
S_b_monero: msg.S_b_monero,
|
||||||
S_a_bitcoin: self.S_a_bitcoin,
|
S_b_bitcoin: msg.S_b_bitcoin,
|
||||||
S_b_monero: msg.S_b_monero,
|
v,
|
||||||
S_b_bitcoin: msg.S_b_bitcoin,
|
v_a: self.v_a,
|
||||||
v,
|
dleq_proof_s_a: self.dleq_proof_s_a,
|
||||||
v_a: self.v_a,
|
btc: self.btc,
|
||||||
dleq_proof_s_a: self.dleq_proof_s_a,
|
xmr: self.xmr,
|
||||||
btc: self.btc,
|
cancel_timelock: self.cancel_timelock,
|
||||||
xmr: self.xmr,
|
punish_timelock: self.punish_timelock,
|
||||||
cancel_timelock: self.cancel_timelock,
|
refund_address: msg.refund_address,
|
||||||
punish_timelock: self.punish_timelock,
|
redeem_address: self.redeem_address,
|
||||||
refund_address: msg.refund_address,
|
punish_address: self.punish_address,
|
||||||
redeem_address: self.redeem_address,
|
}))
|
||||||
punish_address: self.punish_address,
|
|
||||||
},
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,16 +155,13 @@ async fn init_containers(cli: &Cli) -> (Monero, Containers<'_>) {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
(
|
(monero, Containers {
|
||||||
monero,
|
bitcoind_url,
|
||||||
Containers {
|
bitcoind,
|
||||||
bitcoind_url,
|
monerod_container,
|
||||||
bitcoind,
|
monero_wallet_rpc_containers,
|
||||||
monerod_container,
|
electrs,
|
||||||
monero_wallet_rpc_containers,
|
})
|
||||||
electrs,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn init_bitcoind_container(
|
async fn init_bitcoind_container(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user