@ -3,17 +3,17 @@ use crate::bitcoin::{
self , current_epoch , CancelTimelock , ExpiredTimelocks , PunishTimelock , Transaction , TxCancel ,
self , current_epoch , CancelTimelock , ExpiredTimelocks , PunishTimelock , Transaction , TxCancel ,
TxLock , Txid ,
TxLock , Txid ,
} ;
} ;
use crate ::mo nero;
use crate ::wow nero;
use crate ::mo nero::wallet ::WatchRequest ;
use crate ::wow nero::wallet ::WatchRequest ;
use crate ::monero::{ mo nero_private_key, TransferProof } ;
use crate ::wownero::{ wow nero_private_key, TransferProof } ;
use crate ::mo nero_ext::ScalarExt ;
use crate ::wow nero_ext::ScalarExt ;
use crate ::protocol ::{ Message0 , Message1 , Message2 , Message3 , Message4 , CROSS_CURVE_PROOF_SYSTEM } ;
use crate ::protocol ::{ Message0 , Message1 , Message2 , Message3 , Message4 , CROSS_CURVE_PROOF_SYSTEM } ;
use anyhow ::{ anyhow , bail , Context , Result } ;
use anyhow ::{ anyhow , bail , Context , Result } ;
use bdk ::database ::BatchDatabase ;
use bdk ::database ::BatchDatabase ;
use ecdsa_fun ::adaptor ::{ Adaptor , HashTranscript } ;
use ecdsa_fun ::adaptor ::{ Adaptor , HashTranscript } ;
use ecdsa_fun ::nonce ::Deterministic ;
use ecdsa_fun ::nonce ::Deterministic ;
use ecdsa_fun ::Signature ;
use ecdsa_fun ::Signature ;
use mo nero_rpc::wallet ::BlockHeight ;
use wow nero_rpc::wallet ::BlockHeight ;
use rand ::{ CryptoRng , RngCore } ;
use rand ::{ CryptoRng , RngCore } ;
use serde ::{ Deserialize , Serialize } ;
use serde ::{ Deserialize , Serialize } ;
use sha2 ::Sha256 ;
use sha2 ::Sha256 ;
@ -29,18 +29,18 @@ pub enum BobState {
} ,
} ,
SwapSetupCompleted ( State2 ) ,
SwapSetupCompleted ( State2 ) ,
BtcLocked ( State3 ) ,
BtcLocked ( State3 ) ,
Xmr LockProofReceived {
Wow LockProofReceived {
state : State3 ,
state : State3 ,
lock_transfer_proof : TransferProof ,
lock_transfer_proof : TransferProof ,
mo nero_wallet_restore_blockheight: BlockHeight ,
wow nero_wallet_restore_blockheight: BlockHeight ,
} ,
} ,
Xmr Locked( State4 ) ,
Wow Locked( State4 ) ,
EncSigSent ( State4 ) ,
EncSigSent ( State4 ) ,
BtcRedeemed ( State5 ) ,
BtcRedeemed ( State5 ) ,
CancelTimelockExpired ( State6 ) ,
CancelTimelockExpired ( State6 ) ,
BtcCancelled ( State6 ) ,
BtcCancelled ( State6 ) ,
BtcRefunded ( State6 ) ,
BtcRefunded ( State6 ) ,
Xmr Redeemed {
Wow Redeemed {
tx_lock_id : bitcoin ::Txid ,
tx_lock_id : bitcoin ::Txid ,
} ,
} ,
BtcPunished {
BtcPunished {
@ -55,16 +55,16 @@ impl fmt::Display for BobState {
BobState ::Started { .. } = > write! ( f , "quote has been requested" ) ,
BobState ::Started { .. } = > write! ( f , "quote has been requested" ) ,
BobState ::SwapSetupCompleted ( .. ) = > write! ( f , "execution setup done" ) ,
BobState ::SwapSetupCompleted ( .. ) = > write! ( f , "execution setup done" ) ,
BobState ::BtcLocked ( .. ) = > write! ( f , "btc is locked" ) ,
BobState ::BtcLocked ( .. ) = > write! ( f , "btc is locked" ) ,
BobState ::Xmr LockProofReceived { .. } = > {
BobState ::Wow LockProofReceived { .. } = > {
write! ( f , " XMR lock transaction transfer proof received")
write! ( f , " WOW lock transaction transfer proof received")
}
}
BobState ::Xmr Locked( .. ) = > write! ( f , " xmr is locked") ,
BobState ::Wow Locked( .. ) = > write! ( f , " wow is locked") ,
BobState ::EncSigSent ( .. ) = > write! ( f , "encrypted signature is sent" ) ,
BobState ::EncSigSent ( .. ) = > write! ( f , "encrypted signature is sent" ) ,
BobState ::BtcRedeemed ( .. ) = > write! ( f , "btc is redeemed" ) ,
BobState ::BtcRedeemed ( .. ) = > write! ( f , "btc is redeemed" ) ,
BobState ::CancelTimelockExpired ( .. ) = > write! ( f , "cancel timelock is expired" ) ,
BobState ::CancelTimelockExpired ( .. ) = > write! ( f , "cancel timelock is expired" ) ,
BobState ::BtcCancelled ( .. ) = > write! ( f , "btc is cancelled" ) ,
BobState ::BtcCancelled ( .. ) = > write! ( f , "btc is cancelled" ) ,
BobState ::BtcRefunded ( .. ) = > write! ( f , "btc is refunded" ) ,
BobState ::BtcRefunded ( .. ) = > write! ( f , "btc is refunded" ) ,
BobState ::Xmr Redeemed { .. } = > write! ( f , " xmr is redeemed") ,
BobState ::Wow Redeemed { .. } = > write! ( f , " wow is redeemed") ,
BobState ::BtcPunished { .. } = > write! ( f , "btc is punished" ) ,
BobState ::BtcPunished { .. } = > write! ( f , "btc is punished" ) ,
BobState ::SafelyAborted = > write! ( f , "safely aborted" ) ,
BobState ::SafelyAborted = > write! ( f , "safely aborted" ) ,
}
}
@ -75,17 +75,17 @@ impl fmt::Display for BobState {
pub struct State0 {
pub struct State0 {
swap_id : Uuid ,
swap_id : Uuid ,
b : bitcoin ::SecretKey ,
b : bitcoin ::SecretKey ,
s_b : mo nero::Scalar ,
s_b : wow nero::Scalar ,
S_b_ monero: mo nero::PublicKey ,
S_b_ wownero: wow nero::PublicKey ,
S_b_bitcoin : bitcoin ::PublicKey ,
S_b_bitcoin : bitcoin ::PublicKey ,
v_b : mo nero::PrivateViewKey ,
v_b : wow nero::PrivateViewKey ,
dleq_proof_s_b : CrossCurveDLEQProof ,
dleq_proof_s_b : CrossCurveDLEQProof ,
btc : bitcoin ::Amount ,
btc : bitcoin ::Amount ,
xmr: mo nero::Amount ,
wow: wow nero::Amount ,
cancel_timelock : CancelTimelock ,
cancel_timelock : CancelTimelock ,
punish_timelock : PunishTimelock ,
punish_timelock : PunishTimelock ,
refund_address : bitcoin ::Address ,
refund_address : bitcoin ::Address ,
min_ mo nero_confirmations: u64 ,
min_ wow nero_confirmations: u64 ,
tx_refund_fee : bitcoin ::Amount ,
tx_refund_fee : bitcoin ::Amount ,
tx_cancel_fee : bitcoin ::Amount ,
tx_cancel_fee : bitcoin ::Amount ,
}
}
@ -96,20 +96,20 @@ impl State0 {
swap_id : Uuid ,
swap_id : Uuid ,
rng : & mut R ,
rng : & mut R ,
btc : bitcoin ::Amount ,
btc : bitcoin ::Amount ,
xmr: mo nero::Amount ,
wow: wow nero::Amount ,
cancel_timelock : CancelTimelock ,
cancel_timelock : CancelTimelock ,
punish_timelock : PunishTimelock ,
punish_timelock : PunishTimelock ,
refund_address : bitcoin ::Address ,
refund_address : bitcoin ::Address ,
min_ mo nero_confirmations: u64 ,
min_ wow nero_confirmations: u64 ,
tx_refund_fee : bitcoin ::Amount ,
tx_refund_fee : bitcoin ::Amount ,
tx_cancel_fee : bitcoin ::Amount ,
tx_cancel_fee : bitcoin ::Amount ,
) -> Self {
) -> Self {
let b = bitcoin ::SecretKey ::new_random ( rng ) ;
let b = bitcoin ::SecretKey ::new_random ( rng ) ;
let s_b = mo nero::Scalar ::random ( rng ) ;
let s_b = wow nero::Scalar ::random ( rng ) ;
let v_b = mo nero::PrivateViewKey ::new_random ( rng ) ;
let v_b = wow nero::PrivateViewKey ::new_random ( rng ) ;
let ( dleq_proof_s_b , ( S_b_bitcoin , S_b_ mo nero) ) = CROSS_CURVE_PROOF_SYSTEM . prove ( & s_b , rng ) ;
let ( dleq_proof_s_b , ( S_b_bitcoin , S_b_ wow nero) ) = CROSS_CURVE_PROOF_SYSTEM . prove ( & s_b , rng ) ;
Self {
Self {
swap_id ,
swap_id ,
@ -117,16 +117,16 @@ impl State0 {
s_b ,
s_b ,
v_b ,
v_b ,
S_b_bitcoin : bitcoin ::PublicKey ::from ( S_b_bitcoin ) ,
S_b_bitcoin : bitcoin ::PublicKey ::from ( S_b_bitcoin ) ,
S_b_ monero: mo nero::PublicKey {
S_b_ wownero: wow nero::PublicKey {
point : S_b_ mo nero. compress ( ) ,
point : S_b_ wow nero. compress ( ) ,
} ,
} ,
btc ,
btc ,
xmr ,
wow ,
dleq_proof_s_b ,
dleq_proof_s_b ,
cancel_timelock ,
cancel_timelock ,
punish_timelock ,
punish_timelock ,
refund_address ,
refund_address ,
min_ mo nero_confirmations,
min_ wow nero_confirmations,
tx_refund_fee ,
tx_refund_fee ,
tx_cancel_fee ,
tx_cancel_fee ,
}
}
@ -136,7 +136,7 @@ impl State0 {
Message0 {
Message0 {
swap_id : self . swap_id ,
swap_id : self . swap_id ,
B : self . b . public ( ) ,
B : self . b . public ( ) ,
S_b_ monero: self . S_b_mo nero,
S_b_ wownero: self . S_b_wow nero,
S_b_bitcoin : self . S_b_bitcoin ,
S_b_bitcoin : self . S_b_bitcoin ,
dleq_proof_s_b : self . dleq_proof_s_b . clone ( ) ,
dleq_proof_s_b : self . dleq_proof_s_b . clone ( ) ,
v_b : self . v_b ,
v_b : self . v_b ,
@ -159,10 +159,10 @@ impl State0 {
& msg . dleq_proof_s_a ,
& msg . dleq_proof_s_a ,
(
(
msg . S_a_bitcoin . into ( ) ,
msg . S_a_bitcoin . into ( ) ,
msg . S_a_ mo nero
msg . S_a_ wow nero
. point
. point
. decompress ( )
. decompress ( )
. ok_or_else ( | | anyhow ! ( "S_a is not a mo nero curve point") ) ? ,
. ok_or_else ( | | anyhow ! ( "S_a is not a wow nero curve point") ) ? ,
) ,
) ,
) ;
) ;
@ -184,17 +184,17 @@ impl State0 {
A : msg . A ,
A : msg . A ,
b : self . b ,
b : self . b ,
s_b : self . s_b ,
s_b : self . s_b ,
S_a_ monero: msg . S_a_mo nero,
S_a_ wownero: msg . S_a_wow nero,
S_a_bitcoin : msg . S_a_bitcoin ,
S_a_bitcoin : msg . S_a_bitcoin ,
v ,
v ,
xmr: self . xmr ,
wow: self . wow ,
cancel_timelock : self . cancel_timelock ,
cancel_timelock : self . cancel_timelock ,
punish_timelock : self . punish_timelock ,
punish_timelock : self . punish_timelock ,
refund_address : self . refund_address ,
refund_address : self . refund_address ,
redeem_address : msg . redeem_address ,
redeem_address : msg . redeem_address ,
punish_address : msg . punish_address ,
punish_address : msg . punish_address ,
tx_lock ,
tx_lock ,
min_ monero_confirmations: self . min_mo nero_confirmations,
min_ wownero_confirmations: self . min_wow nero_confirmations,
tx_redeem_fee : msg . tx_redeem_fee ,
tx_redeem_fee : msg . tx_redeem_fee ,
tx_refund_fee : self . tx_refund_fee ,
tx_refund_fee : self . tx_refund_fee ,
tx_punish_fee : msg . tx_punish_fee ,
tx_punish_fee : msg . tx_punish_fee ,
@ -207,18 +207,18 @@ impl State0 {
pub struct State1 {
pub struct State1 {
A : bitcoin ::PublicKey ,
A : bitcoin ::PublicKey ,
b : bitcoin ::SecretKey ,
b : bitcoin ::SecretKey ,
s_b : mo nero::Scalar ,
s_b : wow nero::Scalar ,
S_a_ monero: mo nero::PublicKey ,
S_a_ wownero: wow nero::PublicKey ,
S_a_bitcoin : bitcoin ::PublicKey ,
S_a_bitcoin : bitcoin ::PublicKey ,
v : mo nero::PrivateViewKey ,
v : wow nero::PrivateViewKey ,
xmr: mo nero::Amount ,
wow: wow nero::Amount ,
cancel_timelock : CancelTimelock ,
cancel_timelock : CancelTimelock ,
punish_timelock : PunishTimelock ,
punish_timelock : PunishTimelock ,
refund_address : bitcoin ::Address ,
refund_address : bitcoin ::Address ,
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_ mo nero_confirmations: u64 ,
min_ wow nero_confirmations: u64 ,
tx_redeem_fee : bitcoin ::Amount ,
tx_redeem_fee : bitcoin ::Amount ,
tx_refund_fee : bitcoin ::Amount ,
tx_refund_fee : bitcoin ::Amount ,
tx_punish_fee : bitcoin ::Amount ,
tx_punish_fee : bitcoin ::Amount ,
@ -255,10 +255,10 @@ impl State1 {
A : self . A ,
A : self . A ,
b : self . b ,
b : self . b ,
s_b : self . s_b ,
s_b : self . s_b ,
S_a_ monero: self . S_a_mo nero,
S_a_ wownero: self . S_a_wow nero,
S_a_bitcoin : self . S_a_bitcoin ,
S_a_bitcoin : self . S_a_bitcoin ,
v : self . v ,
v : self . v ,
xmr: self . xmr ,
wow: self . wow ,
cancel_timelock : self . cancel_timelock ,
cancel_timelock : self . cancel_timelock ,
punish_timelock : self . punish_timelock ,
punish_timelock : self . punish_timelock ,
refund_address : self . refund_address ,
refund_address : self . refund_address ,
@ -267,7 +267,7 @@ impl State1 {
tx_lock : self . tx_lock ,
tx_lock : self . tx_lock ,
tx_cancel_sig_a : msg . tx_cancel_sig ,
tx_cancel_sig_a : msg . tx_cancel_sig ,
tx_refund_encsig : msg . tx_refund_encsig ,
tx_refund_encsig : msg . tx_refund_encsig ,
min_ monero_confirmations: self . min_mo nero_confirmations,
min_ wownero_confirmations: self . min_wow nero_confirmations,
tx_redeem_fee : self . tx_redeem_fee ,
tx_redeem_fee : self . tx_redeem_fee ,
tx_refund_fee : self . tx_refund_fee ,
tx_refund_fee : self . tx_refund_fee ,
tx_punish_fee : self . tx_punish_fee ,
tx_punish_fee : self . tx_punish_fee ,
@ -280,11 +280,11 @@ impl State1 {
pub struct State2 {
pub struct State2 {
A : bitcoin ::PublicKey ,
A : bitcoin ::PublicKey ,
b : bitcoin ::SecretKey ,
b : bitcoin ::SecretKey ,
s_b : mo nero::Scalar ,
s_b : wow nero::Scalar ,
S_a_ monero: mo nero::PublicKey ,
S_a_ wownero: wow nero::PublicKey ,
S_a_bitcoin : bitcoin ::PublicKey ,
S_a_bitcoin : bitcoin ::PublicKey ,
v : mo nero::PrivateViewKey ,
v : wow nero::PrivateViewKey ,
xmr: mo nero::Amount ,
wow: wow nero::Amount ,
cancel_timelock : CancelTimelock ,
cancel_timelock : CancelTimelock ,
punish_timelock : PunishTimelock ,
punish_timelock : PunishTimelock ,
refund_address : bitcoin ::Address ,
refund_address : bitcoin ::Address ,
@ -293,7 +293,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_ mo nero_confirmations: u64 ,
min_ wow nero_confirmations: u64 ,
#[ serde(with = " ::bitcoin::util::amount::serde::as_sat " ) ]
#[ serde(with = " ::bitcoin::util::amount::serde::as_sat " ) ]
tx_redeem_fee : bitcoin ::Amount ,
tx_redeem_fee : bitcoin ::Amount ,
#[ serde(with = " ::bitcoin::util::amount::serde::as_sat " ) ]
#[ serde(with = " ::bitcoin::util::amount::serde::as_sat " ) ]
@ -334,10 +334,10 @@ impl State2 {
A : self . A ,
A : self . A ,
b : self . b ,
b : self . b ,
s_b : self . s_b ,
s_b : self . s_b ,
S_a_ monero: self . S_a_mo nero,
S_a_ wownero: self . S_a_wow nero,
S_a_bitcoin : self . S_a_bitcoin ,
S_a_bitcoin : self . S_a_bitcoin ,
v : self . v ,
v : self . v ,
xmr: self . xmr ,
wow: self . wow ,
cancel_timelock : self . cancel_timelock ,
cancel_timelock : self . cancel_timelock ,
punish_timelock : self . punish_timelock ,
punish_timelock : self . punish_timelock ,
refund_address : self . refund_address ,
refund_address : self . refund_address ,
@ -345,7 +345,7 @@ impl State2 {
tx_lock : self . tx_lock . clone ( ) ,
tx_lock : self . tx_lock . clone ( ) ,
tx_cancel_sig_a : self . tx_cancel_sig_a ,
tx_cancel_sig_a : self . tx_cancel_sig_a ,
tx_refund_encsig : self . tx_refund_encsig ,
tx_refund_encsig : self . tx_refund_encsig ,
min_ monero_confirmations: self . min_mo nero_confirmations,
min_ wownero_confirmations: self . min_wow nero_confirmations,
tx_redeem_fee : self . tx_redeem_fee ,
tx_redeem_fee : self . tx_redeem_fee ,
tx_refund_fee : self . tx_refund_fee ,
tx_refund_fee : self . tx_refund_fee ,
tx_cancel_fee : self . tx_cancel_fee ,
tx_cancel_fee : self . tx_cancel_fee ,
@ -359,11 +359,11 @@ impl State2 {
pub struct State3 {
pub struct State3 {
A : bitcoin ::PublicKey ,
A : bitcoin ::PublicKey ,
b : bitcoin ::SecretKey ,
b : bitcoin ::SecretKey ,
s_b : mo nero::Scalar ,
s_b : wow nero::Scalar ,
S_a_ monero: mo nero::PublicKey ,
S_a_ wownero: wow nero::PublicKey ,
S_a_bitcoin : bitcoin ::PublicKey ,
S_a_bitcoin : bitcoin ::PublicKey ,
v : mo nero::PrivateViewKey ,
v : wow nero::PrivateViewKey ,
xmr: mo nero::Amount ,
wow: wow nero::Amount ,
pub cancel_timelock : CancelTimelock ,
pub cancel_timelock : CancelTimelock ,
punish_timelock : PunishTimelock ,
punish_timelock : PunishTimelock ,
refund_address : bitcoin ::Address ,
refund_address : bitcoin ::Address ,
@ -371,7 +371,7 @@ pub struct State3 {
pub tx_lock : bitcoin ::TxLock ,
pub 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_ mo nero_confirmations: u64 ,
min_ wow nero_confirmations: u64 ,
#[ serde(with = " ::bitcoin::util::amount::serde::as_sat " ) ]
#[ serde(with = " ::bitcoin::util::amount::serde::as_sat " ) ]
tx_redeem_fee : bitcoin ::Amount ,
tx_redeem_fee : bitcoin ::Amount ,
#[ serde(with = " ::bitcoin::util::amount::serde::as_sat " ) ]
#[ serde(with = " ::bitcoin::util::amount::serde::as_sat " ) ]
@ -381,21 +381,21 @@ pub struct State3 {
}
}
impl State3 {
impl State3 {
pub fn lock_ xmr _watch_request( & self , transfer_proof : TransferProof ) -> WatchRequest {
pub fn lock_ wow _watch_request( & self , transfer_proof : TransferProof ) -> WatchRequest {
let S_b_ mo nero =
let S_b_ wow nero =
monero::PublicKey ::from_private_key ( & mo nero::PrivateKey ::from_scalar ( self . s_b ) ) ;
wownero::PublicKey ::from_private_key ( & wow nero::PrivateKey ::from_scalar ( self . s_b ) ) ;
let S = self . S_a_ monero + S_b_mo nero;
let S = self . S_a_ wownero + S_b_wow nero;
WatchRequest {
WatchRequest {
public_spend_key : S ,
public_spend_key : S ,
public_view_key : self . v . public ( ) ,
public_view_key : self . v . public ( ) ,
transfer_proof ,
transfer_proof ,
conf_target : self . min_ mo nero_confirmations,
conf_target : self . min_ wow nero_confirmations,
expected : self . xmr ,
expected : self . wow ,
}
}
}
}
pub fn xmr_locked( self , mo nero_wallet_restore_blockheight: BlockHeight ) -> State4 {
pub fn wow_locked( self , wow nero_wallet_restore_blockheight: BlockHeight ) -> State4 {
State4 {
State4 {
A : self . A ,
A : self . A ,
b : self . b ,
b : self . b ,
@ -409,7 +409,7 @@ impl State3 {
tx_lock : self . tx_lock ,
tx_lock : self . tx_lock ,
tx_cancel_sig_a : self . tx_cancel_sig_a ,
tx_cancel_sig_a : self . tx_cancel_sig_a ,
tx_refund_encsig : self . tx_refund_encsig ,
tx_refund_encsig : self . tx_refund_encsig ,
mo nero_wallet_restore_blockheight,
wow nero_wallet_restore_blockheight,
tx_redeem_fee : self . tx_redeem_fee ,
tx_redeem_fee : self . tx_redeem_fee ,
tx_refund_fee : self . tx_refund_fee ,
tx_refund_fee : self . tx_refund_fee ,
tx_cancel_fee : self . tx_cancel_fee ,
tx_cancel_fee : self . tx_cancel_fee ,
@ -464,9 +464,9 @@ impl State3 {
pub struct State4 {
pub struct State4 {
A : bitcoin ::PublicKey ,
A : bitcoin ::PublicKey ,
b : bitcoin ::SecretKey ,
b : bitcoin ::SecretKey ,
s_b : mo nero::Scalar ,
s_b : wow nero::Scalar ,
S_a_bitcoin : bitcoin ::PublicKey ,
S_a_bitcoin : bitcoin ::PublicKey ,
v : mo nero::PrivateViewKey ,
v : wow nero::PrivateViewKey ,
pub cancel_timelock : CancelTimelock ,
pub cancel_timelock : CancelTimelock ,
punish_timelock : PunishTimelock ,
punish_timelock : PunishTimelock ,
refund_address : bitcoin ::Address ,
refund_address : bitcoin ::Address ,
@ -474,7 +474,7 @@ pub struct State4 {
pub tx_lock : bitcoin ::TxLock ,
pub tx_lock : bitcoin ::TxLock ,
tx_cancel_sig_a : Signature ,
tx_cancel_sig_a : Signature ,
tx_refund_encsig : bitcoin ::EncryptedSignature ,
tx_refund_encsig : bitcoin ::EncryptedSignature ,
mo nero_wallet_restore_blockheight: BlockHeight ,
wow nero_wallet_restore_blockheight: BlockHeight ,
#[ serde(with = " ::bitcoin::util::amount::serde::as_sat " ) ]
#[ serde(with = " ::bitcoin::util::amount::serde::as_sat " ) ]
tx_redeem_fee : bitcoin ::Amount ,
tx_redeem_fee : bitcoin ::Amount ,
#[ serde(with = " ::bitcoin::util::amount::serde::as_sat " ) ]
#[ serde(with = " ::bitcoin::util::amount::serde::as_sat " ) ]
@ -506,14 +506,14 @@ impl State4 {
let tx_redeem_sig =
let tx_redeem_sig =
tx_redeem . extract_signature_by_key ( tx_redeem_candidate , self . b . public ( ) ) ? ;
tx_redeem . extract_signature_by_key ( tx_redeem_candidate , self . b . public ( ) ) ? ;
let s_a = bitcoin ::recover ( self . S_a_bitcoin , tx_redeem_sig , tx_redeem_encsig ) ? ;
let s_a = bitcoin ::recover ( self . S_a_bitcoin , tx_redeem_sig , tx_redeem_encsig ) ? ;
let s_a = mo nero::private_key_from_secp256k1_scalar ( s_a . into ( ) ) ;
let s_a = wow nero::private_key_from_secp256k1_scalar ( s_a . into ( ) ) ;
Ok ( State5 {
Ok ( State5 {
s_a ,
s_a ,
s_b : self . s_b ,
s_b : self . s_b ,
v : self . v ,
v : self . v ,
tx_lock : self . tx_lock . clone ( ) ,
tx_lock : self . tx_lock . clone ( ) ,
monero_wallet_restore_blockheight: self . mo nero_wallet_restore_blockheight,
wownero_wallet_restore_blockheight: self . wow nero_wallet_restore_blockheight,
} )
} )
}
}
@ -559,17 +559,17 @@ impl State4 {
#[ derive(Debug, Clone, Deserialize, Serialize, PartialEq) ]
#[ derive(Debug, Clone, Deserialize, Serialize, PartialEq) ]
pub struct State5 {
pub struct State5 {
#[ serde(with = " mo nero_private_key" ) ]
#[ serde(with = " wow nero_private_key" ) ]
s_a : mo nero::PrivateKey ,
s_a : wow nero::PrivateKey ,
s_b : mo nero::Scalar ,
s_b : wow nero::Scalar ,
v : mo nero::PrivateViewKey ,
v : wow nero::PrivateViewKey ,
tx_lock : bitcoin ::TxLock ,
tx_lock : bitcoin ::TxLock ,
pub mo nero_wallet_restore_blockheight: BlockHeight ,
pub wow nero_wallet_restore_blockheight: BlockHeight ,
}
}
impl State5 {
impl State5 {
pub fn xmr_keys( & self ) -> ( monero ::PrivateKey , mo nero::PrivateViewKey ) {
pub fn wow_keys( & self ) -> ( wownero ::PrivateKey , wow nero::PrivateViewKey ) {
let s_b = mo nero::PrivateKey { scalar : self . s_b } ;
let s_b = wow nero::PrivateKey { scalar : self . s_b } ;
let s = self . s_a + s_b ;
let s = self . s_a + s_b ;
( s , self . v )
( s , self . v )
@ -584,7 +584,7 @@ impl State5 {
pub struct State6 {
pub struct State6 {
A : bitcoin ::PublicKey ,
A : bitcoin ::PublicKey ,
b : bitcoin ::SecretKey ,
b : bitcoin ::SecretKey ,
s_b : mo nero::Scalar ,
s_b : wow nero::Scalar ,
cancel_timelock : CancelTimelock ,
cancel_timelock : CancelTimelock ,
punish_timelock : PunishTimelock ,
punish_timelock : PunishTimelock ,
refund_address : bitcoin ::Address ,
refund_address : bitcoin ::Address ,