Avoid possible mix up between timelocks

Introduce new type to ensure no mix up happens when ordering the fields
in function calls.
This commit is contained in:
Franck Royer 2021-02-15 12:19:43 +11:00
parent 9a321a4f09
commit b8a84aa34b
No known key found for this signature in database
GPG key ID: A82ED75A8DFC50A4
12 changed files with 121 additions and 104 deletions

View file

@ -1,9 +1,8 @@
use crate::{
bitcoin,
bitcoin::{
poll_until_block_height_is_gte,
timelocks::{BlockHeight, Timelock},
BroadcastSignedTransaction, EncryptedSignature, GetBlockHeight, GetRawTransaction,
poll_until_block_height_is_gte, BlockHeight, BroadcastSignedTransaction, CancelTimelock,
EncryptedSignature, GetBlockHeight, GetRawTransaction, PunishTimelock,
TransactionBlockHeight, TxCancel, TxLock, TxRefund, WaitForTransactionFinality,
WatchForRawTransaction,
},
@ -151,7 +150,7 @@ pub async fn publish_cancel_transaction<W>(
tx_lock: TxLock,
a: bitcoin::SecretKey,
B: bitcoin::PublicKey,
cancel_timelock: Timelock,
cancel_timelock: CancelTimelock,
tx_cancel_sig_bob: bitcoin::Signature,
bitcoin_wallet: Arc<W>,
) -> Result<bitcoin::TxCancel>
@ -198,7 +197,7 @@ where
pub async fn wait_for_bitcoin_refund<W>(
tx_cancel: &TxCancel,
cancel_tx_height: BlockHeight,
punish_timelock: Timelock,
punish_timelock: PunishTimelock,
refund_address: &bitcoin::Address,
bitcoin_wallet: Arc<W>,
) -> Result<(bitcoin::TxRefund, Option<bitcoin::Transaction>)>
@ -250,9 +249,9 @@ pub fn extract_monero_private_key(
pub fn build_bitcoin_punish_transaction(
tx_lock: &TxLock,
cancel_timelock: Timelock,
cancel_timelock: CancelTimelock,
punish_address: &bitcoin::Address,
punish_timelock: Timelock,
punish_timelock: PunishTimelock,
tx_punish_sig_bob: bitcoin::Signature,
a: bitcoin::SecretKey,
B: bitcoin::PublicKey,