mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-02-21 07:09:51 -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> {
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,8 @@ impl ConfidentialTransactionBuilder {
|
||||
input_commitment: input_to_spend.commitment().unwrap(), // TODO: Error handling
|
||||
spend_amount: input_to_spend.amount().unwrap(), // TODO: Error handling,
|
||||
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()
|
||||
.max()
|
||||
.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)))
|
||||
}
|
||||
@ -340,7 +342,8 @@ impl FetchDecoyInputs for monerod::Client {
|
||||
.map(|(out_key, index)| {
|
||||
DecoyInput {
|
||||
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(),
|
||||
}
|
||||
})
|
||||
@ -378,22 +381,19 @@ mod tests {
|
||||
|
||||
let relative_offsets = to_relative_offsets(&key_offsets);
|
||||
|
||||
assert_eq!(
|
||||
&relative_offsets,
|
||||
&[
|
||||
VarInt(78),
|
||||
VarInt(3),
|
||||
VarInt(10),
|
||||
VarInt(0),
|
||||
VarInt(5),
|
||||
VarInt(2),
|
||||
VarInt(3),
|
||||
VarInt(11),
|
||||
VarInt(1),
|
||||
VarInt(1),
|
||||
VarInt(3),
|
||||
]
|
||||
)
|
||||
assert_eq!(&relative_offsets, &[
|
||||
VarInt(78),
|
||||
VarInt(3),
|
||||
VarInt(10),
|
||||
VarInt(0),
|
||||
VarInt(5),
|
||||
VarInt(2),
|
||||
VarInt(3),
|
||||
VarInt(11),
|
||||
VarInt(1),
|
||||
VarInt(1),
|
||||
VarInt(3),
|
||||
])
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
@ -9,7 +9,10 @@ pub struct EmptyTransaction {}
|
||||
|
||||
impl EmptyTransaction {
|
||||
// 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!()
|
||||
}
|
||||
}
|
||||
@ -19,7 +22,10 @@ pub struct MissingOpening; // The opening was missing from the TX
|
||||
pub struct 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!()
|
||||
}
|
||||
|
||||
@ -83,7 +89,9 @@ impl OutputsBlinded {
|
||||
|
||||
/// 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 {
|
||||
// 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.
|
||||
///
|
||||
/// This function is useful if the caller wants to have full control over certain parameters such as responses, L, R or I.
|
||||
/// The provided signature will be validated to make sure it is correct.
|
||||
/// This function is useful if the caller wants to have full control over
|
||||
/// 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> {
|
||||
todo!()
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
[toolchain]
|
||||
channel = "nightly-2021-05-04"
|
||||
channel = "nightly-2021-05-18"
|
||||
components = ["clippy"]
|
||||
targets = ["armv7-unknown-linux-gnueabihf"]
|
||||
|
@ -165,28 +165,25 @@ 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,
|
||||
},
|
||||
))
|
||||
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,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,16 +155,13 @@ 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…
x
Reference in New Issue
Block a user