mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-24 06:59:36 -05:00
Monero confirmations are a u64
Trying to deserialize the number as a u32 caused deserialization errors.
This commit is contained in:
parent
1b63d5486d
commit
5616683d7d
@ -470,7 +470,7 @@ struct CheckTxKeyParams {
|
|||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize)]
|
#[derive(Clone, Copy, Debug, Deserialize)]
|
||||||
pub struct CheckTxKey {
|
pub struct CheckTxKey {
|
||||||
pub confirmations: u32,
|
pub confirmations: u64,
|
||||||
pub received: u64,
|
pub received: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ pub struct Config {
|
|||||||
pub bitcoin_punish_timelock: PunishTimelock,
|
pub bitcoin_punish_timelock: PunishTimelock,
|
||||||
pub bitcoin_network: bitcoin::Network,
|
pub bitcoin_network: bitcoin::Network,
|
||||||
pub monero_avg_block_time: Duration,
|
pub monero_avg_block_time: Duration,
|
||||||
pub monero_finality_confirmations: u32,
|
pub monero_finality_confirmations: u64,
|
||||||
pub monero_network: monero::Network,
|
pub monero_network: monero::Network,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ pub struct WatchRequest {
|
|||||||
pub public_spend_key: PublicKey,
|
pub public_spend_key: PublicKey,
|
||||||
pub public_view_key: PublicViewKey,
|
pub public_view_key: PublicViewKey,
|
||||||
pub transfer_proof: TransferProof,
|
pub transfer_proof: TransferProof,
|
||||||
pub conf_target: u32,
|
pub conf_target: u64,
|
||||||
pub expected: Amount,
|
pub expected: Amount,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,12 +280,12 @@ async fn wait_for_confirmations<Fut>(
|
|||||||
fetch_tx: impl Fn(String) -> Fut,
|
fetch_tx: impl Fn(String) -> Fut,
|
||||||
mut check_interval: Interval,
|
mut check_interval: Interval,
|
||||||
expected: Amount,
|
expected: Amount,
|
||||||
conf_target: u32,
|
conf_target: u64,
|
||||||
) -> Result<(), InsufficientFunds>
|
) -> Result<(), InsufficientFunds>
|
||||||
where
|
where
|
||||||
Fut: Future<Output = Result<CheckTxKey>>,
|
Fut: Future<Output = Result<CheckTxKey>>,
|
||||||
{
|
{
|
||||||
let mut seen_confirmations = 0u32;
|
let mut seen_confirmations = 0u64;
|
||||||
|
|
||||||
while seen_confirmations < conf_target {
|
while seen_confirmations < conf_target {
|
||||||
check_interval.tick().await; // tick() at the beginning of the loop so every `continue` tick()s as well
|
check_interval.tick().await; // tick() at the beginning of the loop so every `continue` tick()s as well
|
||||||
@ -323,7 +323,7 @@ where
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use monero_rpc::wallet::CheckTxKey;
|
use monero_rpc::wallet::CheckTxKey;
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, AtomicU64, Ordering};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
@ -364,9 +364,9 @@ mod tests {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn visual_log_check() {
|
async fn visual_log_check() {
|
||||||
let _ = tracing_subscriber::fmt().with_test_writer().try_init();
|
let _ = tracing_subscriber::fmt().with_test_writer().try_init();
|
||||||
const MAX_REQUESTS: u32 = 20;
|
const MAX_REQUESTS: u64 = 20;
|
||||||
|
|
||||||
let requests = Arc::new(AtomicU32::new(0));
|
let requests = Arc::new(AtomicU64::new(0));
|
||||||
|
|
||||||
let result = wait_for_confirmations(
|
let result = wait_for_confirmations(
|
||||||
String::from("TXID"),
|
String::from("TXID"),
|
||||||
|
@ -361,7 +361,7 @@ impl State3 {
|
|||||||
pub fn lock_xmr_watch_request(
|
pub fn lock_xmr_watch_request(
|
||||||
&self,
|
&self,
|
||||||
transfer_proof: TransferProof,
|
transfer_proof: TransferProof,
|
||||||
conf_target: u32,
|
conf_target: u64,
|
||||||
) -> WatchRequest {
|
) -> WatchRequest {
|
||||||
let S_a = monero::PublicKey::from_private_key(&monero::PrivateKey { scalar: self.s_a });
|
let S_a = monero::PublicKey::from_private_key(&monero::PrivateKey { scalar: self.s_a });
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ pub struct State0 {
|
|||||||
cancel_timelock: CancelTimelock,
|
cancel_timelock: CancelTimelock,
|
||||||
punish_timelock: PunishTimelock,
|
punish_timelock: PunishTimelock,
|
||||||
refund_address: bitcoin::Address,
|
refund_address: bitcoin::Address,
|
||||||
min_monero_confirmations: u32,
|
min_monero_confirmations: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State0 {
|
impl State0 {
|
||||||
@ -94,7 +94,7 @@ impl State0 {
|
|||||||
cancel_timelock: CancelTimelock,
|
cancel_timelock: CancelTimelock,
|
||||||
punish_timelock: PunishTimelock,
|
punish_timelock: PunishTimelock,
|
||||||
refund_address: bitcoin::Address,
|
refund_address: bitcoin::Address,
|
||||||
min_monero_confirmations: u32,
|
min_monero_confirmations: u64,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let b = bitcoin::SecretKey::new_random(rng);
|
let b = bitcoin::SecretKey::new_random(rng);
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ pub struct State1 {
|
|||||||
redeem_address: bitcoin::Address,
|
redeem_address: bitcoin::Address,
|
||||||
punish_address: bitcoin::Address,
|
punish_address: bitcoin::Address,
|
||||||
tx_lock: bitcoin::TxLock,
|
tx_lock: bitcoin::TxLock,
|
||||||
min_monero_confirmations: u32,
|
min_monero_confirmations: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State1 {
|
impl State1 {
|
||||||
@ -245,7 +245,7 @@ pub struct State2 {
|
|||||||
tx_lock: bitcoin::TxLock,
|
tx_lock: bitcoin::TxLock,
|
||||||
tx_cancel_sig_a: Signature,
|
tx_cancel_sig_a: Signature,
|
||||||
tx_refund_encsig: bitcoin::EncryptedSignature,
|
tx_refund_encsig: bitcoin::EncryptedSignature,
|
||||||
min_monero_confirmations: u32,
|
min_monero_confirmations: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State2 {
|
impl State2 {
|
||||||
@ -302,7 +302,7 @@ pub struct State3 {
|
|||||||
tx_lock: bitcoin::TxLock,
|
tx_lock: bitcoin::TxLock,
|
||||||
tx_cancel_sig_a: Signature,
|
tx_cancel_sig_a: Signature,
|
||||||
tx_refund_encsig: bitcoin::EncryptedSignature,
|
tx_refund_encsig: bitcoin::EncryptedSignature,
|
||||||
min_monero_confirmations: u32,
|
min_monero_confirmations: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl State3 {
|
impl State3 {
|
||||||
|
Loading…
Reference in New Issue
Block a user