mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-07 05:52:31 -04:00
Use action to name trait
This commit is contained in:
parent
4e91ac467b
commit
81cbc24c46
5 changed files with 25 additions and 25 deletions
|
@ -19,8 +19,8 @@ use xmr_btc::{
|
|||
alice,
|
||||
alice::State3,
|
||||
bitcoin::{
|
||||
poll_until_block_height_is_gte, BlockHeight, BroadcastSignedTransaction,
|
||||
EncryptedSignature, GetRawTransaction, TransactionBlockHeight, TxCancel, TxLock, TxRefund,
|
||||
poll_until_block_height_is_gte, BroadcastSignedTransaction, EncryptedSignature,
|
||||
GetBlockHeight, GetRawTransaction, TransactionBlockHeight, TxCancel, TxLock, TxRefund,
|
||||
WaitForTransactionFinality, WatchForRawTransaction,
|
||||
},
|
||||
config::Config,
|
||||
|
@ -212,7 +212,7 @@ pub async fn publish_cancel_transaction<W>(
|
|||
bitcoin_wallet: Arc<W>,
|
||||
) -> Result<bitcoin::TxCancel>
|
||||
where
|
||||
W: GetRawTransaction + TransactionBlockHeight + BlockHeight + BroadcastSignedTransaction,
|
||||
W: GetRawTransaction + TransactionBlockHeight + GetBlockHeight + BroadcastSignedTransaction,
|
||||
{
|
||||
// First wait for cancel timelock to expire
|
||||
let tx_lock_height = bitcoin_wallet
|
||||
|
@ -259,7 +259,7 @@ pub async fn wait_for_bitcoin_refund<W>(
|
|||
bitcoin_wallet: Arc<W>,
|
||||
) -> Result<(bitcoin::TxRefund, Option<bitcoin::Transaction>)>
|
||||
where
|
||||
W: BlockHeight + WatchForRawTransaction,
|
||||
W: GetBlockHeight + WatchForRawTransaction,
|
||||
{
|
||||
let punish_timelock_expired =
|
||||
poll_until_block_height_is_gte(bitcoin_wallet.as_ref(), cancel_tx_height + punish_timelock);
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::time::Duration;
|
|||
use tokio::time::interval;
|
||||
use xmr_btc::{
|
||||
bitcoin::{
|
||||
BlockHeight, BroadcastSignedTransaction, BuildTxLockPsbt, SignTxLock,
|
||||
BroadcastSignedTransaction, BuildTxLockPsbt, GetBlockHeight, SignTxLock,
|
||||
TransactionBlockHeight, WatchForRawTransaction,
|
||||
},
|
||||
config::Config,
|
||||
|
@ -132,8 +132,8 @@ impl GetRawTransaction for Wallet {
|
|||
}
|
||||
|
||||
#[async_trait]
|
||||
impl BlockHeight for Wallet {
|
||||
async fn block_height(&self) -> u32 {
|
||||
impl GetBlockHeight for Wallet {
|
||||
async fn get_block_height(&self) -> u32 {
|
||||
(|| async { Ok(self.inner.client.getblockcount().await?) })
|
||||
.retry(ConstantBackoff::new(Duration::from_secs(1)))
|
||||
.await
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue