Skip to content

Commit dce6cf9

Browse files
committed
async: prohibit use of sync APIs when async feature gate is used
1 parent 9cbb28b commit dce6cf9

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/contracts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ where
291291
self.with_contract_mut(contract_id, |contract| contract.call(call, seals))
292292
}
293293

294+
#[cfg(not(feature = "async"))]
294295
/// Update the status of all witnesses and single-use seal definitions.
295296
///
296297
/// Applies rollbacks or forwards if required and recomputes the state of the affected

src/popls/bp.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ pub trait WalletProvider {
6565
fn has_utxo(&self, outpoint: Outpoint) -> bool;
6666
fn utxos(&self) -> impl Iterator<Item = Outpoint>;
6767

68+
#[cfg(not(feature = "async"))]
6869
fn update_utxos(&mut self) -> Result<(), Self::Error>;
6970
#[cfg(feature = "async")]
7071
async fn update_utxos_async(&mut self) -> Result<(), Self::Error>;
@@ -79,25 +80,25 @@ pub trait WalletProvider {
7980
fn next_address(&mut self) -> Address;
8081
fn next_nonce(&mut self) -> u64;
8182

83+
#[cfg(not(feature = "async"))]
8284
/// Returns a closure which can retrieve a witness status of an arbitrary transaction id
8385
/// (including the ones that are not related to the wallet).
8486
fn txid_resolver(&self) -> impl Fn(Txid) -> Result<WitnessStatus, Self::Error>;
85-
8687
#[cfg(feature = "async")]
8788
/// Returns a closure which can retrieve a witness status of an arbitrary transaction id
8889
/// (including the ones that are not related to the wallet).
8990
fn txid_resolver_async(&self) -> impl AsyncFn(Txid) -> Result<WitnessStatus, Self::Error>;
9091

92+
#[cfg(not(feature = "async"))]
9193
/// Returns the height of the last known block.
9294
fn last_block_height(&self) -> Result<u64, Self::Error>;
93-
9495
#[cfg(feature = "async")]
9596
/// Returns the height of the last known block.
9697
async fn last_block_height_async(&self) -> Result<u64, Self::Error>;
9798

99+
#[cfg(not(feature = "async"))]
98100
/// Broadcasts the transaction, also updating UTXO set accordingly.
99101
fn broadcast(&mut self, tx: &Tx, change: Option<(Vout, u32, u32)>) -> Result<(), Self::Error>;
100-
101102
#[cfg(feature = "async")]
102103
/// Broadcasts the transaction, also updating UTXO set accordingly.
103104
async fn broadcast_async(
@@ -870,6 +871,7 @@ where
870871
.consume(allow_unknown, reader, seal_resolver, sig_validator)
871872
}
872873

874+
#[cfg(not(feature = "async"))]
873875
/// Update a wallet UTXO set and the status of all witnesses and single-use seal
874876
/// definitions.
875877
///

0 commit comments

Comments
 (0)