mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-24 23:19:34 -05:00
Top to bottom pub mod
then mod
then pub use
then use
(incl. use crate
and use self
)
This commit is contained in:
parent
44c4b5dcea
commit
433704e48c
@ -20,7 +20,6 @@
|
|||||||
//! every BLOCK_TIME_SECS seconds.
|
//! every BLOCK_TIME_SECS seconds.
|
||||||
//!
|
//!
|
||||||
//! Also provides standalone JSON RPC clients for monerod and monero-wallet-rpc.
|
//! Also provides standalone JSON RPC clients for monerod and monero-wallet-rpc.
|
||||||
|
|
||||||
pub mod image;
|
pub mod image;
|
||||||
pub mod rpc;
|
pub mod rpc;
|
||||||
|
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
|
pub mod timelocks;
|
||||||
|
pub mod transactions;
|
||||||
|
pub mod wallet;
|
||||||
|
|
||||||
pub use crate::bitcoin::{
|
pub use crate::bitcoin::{
|
||||||
timelocks::Timelock,
|
timelocks::Timelock,
|
||||||
transactions::{TxCancel, TxLock, TxPunish, TxRedeem, TxRefund},
|
transactions::{TxCancel, TxLock, TxPunish, TxRedeem, TxRefund},
|
||||||
};
|
};
|
||||||
|
pub use ::bitcoin::{util::amount::Amount, Address, Network, Transaction, Txid};
|
||||||
|
pub use ecdsa_fun::{adaptor::EncryptedSignature, fun::Scalar, Signature};
|
||||||
|
pub use wallet::Wallet;
|
||||||
|
|
||||||
use crate::{bitcoin::timelocks::BlockHeight, config::Config, ExpiredTimelocks};
|
use crate::{bitcoin::timelocks::BlockHeight, config::Config, ExpiredTimelocks};
|
||||||
use ::bitcoin::{
|
use ::bitcoin::{
|
||||||
hashes::{hex::ToHex, Hash},
|
hashes::{hex::ToHex, Hash},
|
||||||
@ -9,21 +17,14 @@ use ::bitcoin::{
|
|||||||
util::psbt::PartiallySignedTransaction,
|
util::psbt::PartiallySignedTransaction,
|
||||||
SigHash,
|
SigHash,
|
||||||
};
|
};
|
||||||
pub use ::bitcoin::{util::amount::Amount, Address, Network, Transaction, Txid};
|
|
||||||
use anyhow::{anyhow, bail, Result};
|
use anyhow::{anyhow, bail, Result};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use ecdsa_fun::{adaptor::Adaptor, fun::Point, nonce::Deterministic, ECDSA};
|
use ecdsa_fun::{adaptor::Adaptor, fun::Point, nonce::Deterministic, ECDSA};
|
||||||
pub use ecdsa_fun::{adaptor::EncryptedSignature, fun::Scalar, Signature};
|
|
||||||
use miniscript::{Descriptor, Segwitv0};
|
use miniscript::{Descriptor, Segwitv0};
|
||||||
use rand::{CryptoRng, RngCore};
|
use rand::{CryptoRng, RngCore};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sha2::Sha256;
|
use sha2::Sha256;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
pub use wallet::Wallet;
|
|
||||||
|
|
||||||
pub mod timelocks;
|
|
||||||
pub mod transactions;
|
|
||||||
pub mod wallet;
|
|
||||||
|
|
||||||
// TODO: Configurable tx-fee (note: parties have to agree prior to swapping)
|
// TODO: Configurable tx-fee (note: parties have to agree prior to swapping)
|
||||||
// Current reasoning:
|
// Current reasoning:
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
pub mod seed;
|
pub mod seed;
|
||||||
|
|
||||||
use crate::bitcoin::Timelock;
|
use crate::bitcoin::Timelock;
|
||||||
use conquer_once::Lazy;
|
use conquer_once::Lazy;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
pub use alice::Alice;
|
||||||
|
pub use bob::Bob;
|
||||||
|
|
||||||
use anyhow::{anyhow, bail, Context, Result};
|
use anyhow::{anyhow, bail, Context, Result};
|
||||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||||
use std::{fmt::Display, path::Path};
|
use std::{fmt::Display, path::Path};
|
||||||
@ -5,8 +8,6 @@ use uuid::Uuid;
|
|||||||
|
|
||||||
mod alice;
|
mod alice;
|
||||||
mod bob;
|
mod bob;
|
||||||
pub use alice::Alice;
|
|
||||||
pub use bob::Bob;
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
|
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
|
||||||
pub enum Swap {
|
pub enum Swap {
|
||||||
|
@ -16,19 +16,20 @@
|
|||||||
missing_copy_implementations
|
missing_copy_implementations
|
||||||
)]
|
)]
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::fmt::{self, Display};
|
|
||||||
|
|
||||||
pub mod bitcoin;
|
pub mod bitcoin;
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod database;
|
pub mod database;
|
||||||
mod fs;
|
|
||||||
pub mod monero;
|
pub mod monero;
|
||||||
pub mod network;
|
pub mod network;
|
||||||
pub mod protocol;
|
pub mod protocol;
|
||||||
pub mod seed;
|
pub mod seed;
|
||||||
pub mod trace;
|
pub mod trace;
|
||||||
|
|
||||||
|
mod fs;
|
||||||
|
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::fmt::{self, Display};
|
||||||
|
|
||||||
pub type Never = std::convert::Infallible;
|
pub type Never = std::convert::Infallible;
|
||||||
|
|
||||||
/// XMR/BTC swap amounts.
|
/// XMR/BTC swap amounts.
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
)]
|
)]
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
use crate::cli::{Command, Options, Resume};
|
use crate::cli::{Command, Options, Resume};
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use prettytable::{row, Table};
|
use prettytable::{row, Table};
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
pub mod wallet;
|
pub mod wallet;
|
||||||
|
|
||||||
|
pub use ::monero::{Network, PrivateKey, PublicKey};
|
||||||
|
pub use curve25519_dalek::scalar::Scalar;
|
||||||
|
pub use wallet::Wallet;
|
||||||
|
|
||||||
use crate::bitcoin;
|
use crate::bitcoin;
|
||||||
use ::bitcoin::hashes::core::fmt::Formatter;
|
use ::bitcoin::hashes::core::fmt::Formatter;
|
||||||
pub use ::monero::{Network, PrivateKey, PublicKey};
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
pub use curve25519_dalek::scalar::Scalar;
|
|
||||||
use rand::{CryptoRng, RngCore};
|
use rand::{CryptoRng, RngCore};
|
||||||
use rust_decimal::{
|
use rust_decimal::{
|
||||||
prelude::{FromPrimitive, ToPrimitive},
|
prelude::{FromPrimitive, ToPrimitive},
|
||||||
@ -17,7 +19,6 @@ use std::{
|
|||||||
ops::{Add, Mul, Sub},
|
ops::{Add, Mul, Sub},
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
};
|
};
|
||||||
pub use wallet::Wallet;
|
|
||||||
|
|
||||||
pub const PICONERO_OFFSET: u64 = 1_000_000_000_000;
|
pub const PICONERO_OFFSET: u64 = 1_000_000_000_000;
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
pub mod peer_tracker;
|
||||||
|
pub mod request_response;
|
||||||
|
pub mod transport;
|
||||||
|
|
||||||
use crate::seed::SEED_LENGTH;
|
use crate::seed::SEED_LENGTH;
|
||||||
use bitcoin::hashes::{sha256, Hash, HashEngine};
|
use bitcoin::hashes::{sha256, Hash, HashEngine};
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
@ -5,10 +9,6 @@ use libp2p::{core::Executor, identity::ed25519};
|
|||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use tokio::runtime::Handle;
|
use tokio::runtime::Handle;
|
||||||
|
|
||||||
pub mod peer_tracker;
|
|
||||||
pub mod request_response;
|
|
||||||
pub mod transport;
|
|
||||||
|
|
||||||
#[allow(missing_debug_implementations)]
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct TokioExecutor {
|
pub struct TokioExecutor {
|
||||||
pub handle: Handle,
|
pub handle: Handle,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
pub mod testutils;
|
||||||
|
|
||||||
use swap::protocol::{alice, bob};
|
use swap::protocol::{alice, bob};
|
||||||
use tokio::join;
|
use tokio::join;
|
||||||
|
|
||||||
pub mod testutils;
|
|
||||||
|
|
||||||
/// Run the following tests with RUST_MIN_STACK=10000000
|
/// Run the following tests with RUST_MIN_STACK=10000000
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use swap::protocol::{alice, alice::AliceState, bob};
|
|
||||||
|
|
||||||
pub mod testutils;
|
pub mod testutils;
|
||||||
|
|
||||||
|
use swap::protocol::{alice, alice::AliceState, bob};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn given_alice_restarts_after_encsig_is_learned_resume_swap() {
|
async fn given_alice_restarts_after_encsig_is_learned_resume_swap() {
|
||||||
testutils::setup_test(|mut ctx| async move {
|
testutils::setup_test(|mut ctx| async move {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use swap::protocol::{alice, bob, bob::BobState};
|
|
||||||
|
|
||||||
pub mod testutils;
|
pub mod testutils;
|
||||||
|
|
||||||
|
use swap::protocol::{alice, bob, bob::BobState};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn given_bob_restarts_after_encsig_is_sent_resume_swap() {
|
async fn given_bob_restarts_after_encsig_is_sent_resume_swap() {
|
||||||
testutils::setup_test(|mut ctx| async move {
|
testutils::setup_test(|mut ctx| async move {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
pub mod testutils;
|
||||||
|
|
||||||
use swap::protocol::{
|
use swap::protocol::{
|
||||||
alice, bob,
|
alice, bob,
|
||||||
bob::{swap::is_xmr_locked, BobState},
|
bob::{swap::is_xmr_locked, BobState},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod testutils;
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn given_bob_restarts_after_xmr_is_locked_resume_swap() {
|
async fn given_bob_restarts_after_xmr_is_locked_resume_swap() {
|
||||||
testutils::setup_test(|mut ctx| async move {
|
testutils::setup_test(|mut ctx| async move {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
pub mod testutils;
|
||||||
|
|
||||||
use swap::protocol::{
|
use swap::protocol::{
|
||||||
alice, bob,
|
alice, bob,
|
||||||
bob::{swap::is_btc_locked, BobState},
|
bob::{swap::is_btc_locked, BobState},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod testutils;
|
|
||||||
|
|
||||||
/// Bob locks Btc and Alice locks Xmr. Bob does not act; he fails to send Alice
|
/// Bob locks Btc and Alice locks Xmr. Bob does not act; he fails to send Alice
|
||||||
/// the encsig and fail to refund or redeem. Alice punishes.
|
/// the encsig and fail to refund or redeem. Alice punishes.
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use swap::protocol::{alice, alice::AliceState, bob};
|
|
||||||
|
|
||||||
pub mod testutils;
|
pub mod testutils;
|
||||||
|
|
||||||
|
use swap::protocol::{alice, alice::AliceState, bob};
|
||||||
|
|
||||||
/// Bob locks btc and Alice locks xmr. Alice fails to act so Bob refunds. Alice
|
/// Bob locks btc and Alice locks xmr. Alice fails to act so Bob refunds. Alice
|
||||||
/// then also refunds.
|
/// then also refunds.
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
Loading…
Reference in New Issue
Block a user