cargo fmt signers/scanner

This commit is contained in:
Luke Parker 2024-09-13 05:10:37 -04:00
parent 1b39138472
commit b4e94f3d51
3 changed files with 147 additions and 141 deletions

View file

@ -145,7 +145,8 @@ pub trait ScannerFeed: 'static + Send + Sync + Clone {
getter: &(impl Send + Sync + Get), getter: &(impl Send + Sync + Get),
number: u64, number: u64,
) -> impl Send + Future<Output = Result<Self::Block, String>> { ) -> impl Send + Future<Output = Result<Self::Block, String>> {
async move {let block = match self.unchecked_block_by_number(number).await { async move {
let block = match self.unchecked_block_by_number(number).await {
Ok(block) => block, Ok(block) => block,
Err(e) => Err(format!("couldn't fetch block {number}: {e:?}"))?, Err(e) => Err(format!("couldn't fetch block {number}: {e:?}"))?,
}; };
@ -163,7 +164,8 @@ pub trait ScannerFeed: 'static + Send + Sync + Clone {
} }
} }
Ok(block)} Ok(block)
}
} }
/// The dust threshold for the specified coin. /// The dust threshold for the specified coin.

View file

@ -65,8 +65,10 @@ pub trait Coordinator: 'static + Send + Sync {
) -> impl Send + Future<Output = Result<(), Self::EphemeralError>>; ) -> impl Send + Future<Output = Result<(), Self::EphemeralError>>;
/// Publish a `Batch`. /// Publish a `Batch`.
fn publish_batch(&mut self, batch: Batch) fn publish_batch(
-> impl Send + Future<Output = Result<(), Self::EphemeralError>>; &mut self,
batch: Batch,
) -> impl Send + Future<Output = Result<(), Self::EphemeralError>>;
/// Publish a `SignedBatch`. /// Publish a `SignedBatch`.
fn publish_signed_batch( fn publish_signed_batch(

View file

@ -92,13 +92,15 @@ impl<D: Db, ST: SignableTransaction, P: TransactionPublisher<TransactionFor<ST>>
impl<D: Db, ST: SignableTransaction, P: TransactionPublisher<TransactionFor<ST>>> ContinuallyRan impl<D: Db, ST: SignableTransaction, P: TransactionPublisher<TransactionFor<ST>>> ContinuallyRan
for TransactionSignerTask<D, ST, P> for TransactionSignerTask<D, ST, P>
{ {
fn run_iteration(&mut self) -> impl Send + Future<Output = Result<bool, String>> {async{ fn run_iteration(&mut self) -> impl Send + Future<Output = Result<bool, String>> {
async {
let mut iterated = false; let mut iterated = false;
// Check for new transactions to sign // Check for new transactions to sign
loop { loop {
let mut txn = self.db.txn(); let mut txn = self.db.txn();
let Some(tx) = TransactionsToSign::<ST>::try_recv(&mut txn, &self.keys[0].group_key()) else { let Some(tx) = TransactionsToSign::<ST>::try_recv(&mut txn, &self.keys[0].group_key())
else {
break; break;
}; };
iterated = true; iterated = true;
@ -232,5 +234,5 @@ impl<D: Db, ST: SignableTransaction, P: TransactionPublisher<TransactionFor<ST>>
Ok(iterated) Ok(iterated)
} }
} }
} }