mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 04:39:24 +00:00
Apply an initial set of rustfmt rules
This commit is contained in:
@@ -6,10 +6,13 @@ use serde_json::json;
|
||||
|
||||
use monero::{
|
||||
network::Network,
|
||||
util::{key::PublicKey, address::Address}
|
||||
util::{key::PublicKey, address::Address},
|
||||
};
|
||||
|
||||
use monero_serai::{random_scalar, rpc::{EmptyResponse, RpcError, Rpc}};
|
||||
use monero_serai::{
|
||||
random_scalar,
|
||||
rpc::{EmptyResponse, RpcError, Rpc},
|
||||
};
|
||||
|
||||
pub async fn rpc() -> Rpc {
|
||||
let rpc = Rpc::new("http://127.0.0.1:18081".to_string());
|
||||
@@ -22,8 +25,9 @@ pub async fn rpc() -> Rpc {
|
||||
let addr = Address::standard(
|
||||
Network::Mainnet,
|
||||
PublicKey { point: (&random_scalar(&mut OsRng) * &ED25519_BASEPOINT_TABLE).compress() },
|
||||
PublicKey { point: (&random_scalar(&mut OsRng) * &ED25519_BASEPOINT_TABLE).compress() }
|
||||
).to_string();
|
||||
PublicKey { point: (&random_scalar(&mut OsRng) * &ED25519_BASEPOINT_TABLE).compress() },
|
||||
)
|
||||
.to_string();
|
||||
|
||||
// Mine 10 blocks so we have 10 decoys so decoy selection doesn't fail
|
||||
mine_block(&rpc, &addr).await.unwrap();
|
||||
@@ -32,11 +36,16 @@ pub async fn rpc() -> Rpc {
|
||||
}
|
||||
|
||||
pub async fn mine_block(rpc: &Rpc, address: &str) -> Result<EmptyResponse, RpcError> {
|
||||
rpc.rpc_call("json_rpc", Some(json!({
|
||||
"method": "generateblocks",
|
||||
"params": {
|
||||
"wallet_address": address,
|
||||
"amount_of_blocks": 10
|
||||
},
|
||||
}))).await
|
||||
rpc
|
||||
.rpc_call(
|
||||
"json_rpc",
|
||||
Some(json!({
|
||||
"method": "generateblocks",
|
||||
"params": {
|
||||
"wallet_address": address,
|
||||
"amount_of_blocks": 10
|
||||
},
|
||||
})),
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
@@ -16,9 +16,19 @@ use dalek_ff_group::Scalar;
|
||||
#[cfg(feature = "multisig")]
|
||||
use transcript::{Transcript, RecommendedTranscript};
|
||||
#[cfg(feature = "multisig")]
|
||||
use frost::{curve::Ed25519, tests::{THRESHOLD, key_gen, sign}};
|
||||
use frost::{
|
||||
curve::Ed25519,
|
||||
tests::{THRESHOLD, key_gen, sign},
|
||||
};
|
||||
|
||||
use monero_serai::{random_scalar, wallet::{ViewPair, address::{Network, AddressType}, SignableTransaction}};
|
||||
use monero_serai::{
|
||||
random_scalar,
|
||||
wallet::{
|
||||
ViewPair,
|
||||
address::{Network, AddressType},
|
||||
SignableTransaction,
|
||||
},
|
||||
};
|
||||
|
||||
mod rpc;
|
||||
use crate::rpc::{rpc, mine_block};
|
||||
@@ -122,9 +132,9 @@ async fn send_core(test: usize, multisig: bool) {
|
||||
}
|
||||
}
|
||||
|
||||
let mut signable = SignableTransaction::new(
|
||||
outputs, vec![(addr, amount - 10000000000)], Some(addr), fee
|
||||
).unwrap();
|
||||
let mut signable =
|
||||
SignableTransaction::new(outputs, vec![(addr, amount - 10000000000)], Some(addr), fee)
|
||||
.unwrap();
|
||||
|
||||
if !multisig {
|
||||
tx = Some(signable.sign(&mut OsRng, &rpc, &spend).await.unwrap());
|
||||
@@ -135,13 +145,17 @@ async fn send_core(test: usize, multisig: bool) {
|
||||
for i in 1 ..= THRESHOLD {
|
||||
machines.insert(
|
||||
i,
|
||||
signable.clone().multisig(
|
||||
&rpc,
|
||||
(*keys[&i]).clone(),
|
||||
RecommendedTranscript::new(b"Monero Serai Test Transaction"),
|
||||
rpc.get_height().await.unwrap() - 10,
|
||||
(1 ..= THRESHOLD).collect::<Vec<_>>()
|
||||
).await.unwrap()
|
||||
signable
|
||||
.clone()
|
||||
.multisig(
|
||||
&rpc,
|
||||
(*keys[&i]).clone(),
|
||||
RecommendedTranscript::new(b"Monero Serai Test Transaction"),
|
||||
rpc.get_height().await.unwrap() - 10,
|
||||
(1 ..= THRESHOLD).collect::<Vec<_>>(),
|
||||
)
|
||||
.await
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user