Ran cargo fmt

This commit is contained in:
junderw 2023-06-29 15:48:40 -07:00 committed by Mononaut
parent ccbed8ec58
commit 0ddfa94b59
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
3 changed files with 15 additions and 14 deletions

View File

@ -1,5 +1,6 @@
use crate::{
u32_hasher_types::{u32hashset_new, U32HasherState}, ThreadTransaction,
u32_hasher_types::{u32hashset_new, U32HasherState},
ThreadTransaction,
};
use std::{
cmp::Ordering,
@ -75,15 +76,8 @@ impl Ord for AuditTransaction {
}
#[inline]
fn calc_fee_rate(
fee: f64,
vsize: u32,
) -> f64 {
fee / (if vsize == 0 {
1.0
} else {
f64::from(vsize)
})
fn calc_fee_rate(fee: f64, vsize: u32) -> f64 {
fee / (if vsize == 0 { 1.0 } else { f64::from(vsize) })
}
impl AuditTransaction {
@ -149,7 +143,10 @@ impl AuditTransaction {
/// Safety: This function must NEVER set score to NaN.
#[inline]
fn calc_new_score(&mut self) {
self.score = self.adjusted_fee_per_vsize.min(calc_fee_rate(self.ancestor_fee as f64, self.ancestor_sigop_adjusted_vsize));
self.score = self.adjusted_fee_per_vsize.min(calc_fee_rate(
self.ancestor_fee as f64,
self.ancestor_sigop_adjusted_vsize,
));
}
#[inline]

View File

@ -6,7 +6,7 @@
#![allow(clippy::cast_sign_loss)]
#![allow(clippy::float_cmp)]
use napi::bindgen_prelude::{Result};
use napi::bindgen_prelude::Result;
use napi_derive::napi;
use thread_transaction::ThreadTransaction;
use tracing::{debug, info, trace};
@ -88,7 +88,11 @@ impl GbtGenerator {
///
/// Rejects if the thread panics or if the Mutex is poisoned.
#[napi]
pub async fn update(&self, new_txs: Vec<ThreadTransaction>, remove_txs: Vec<u32>) -> Result<GbtResult> {
pub async fn update(
&self,
new_txs: Vec<ThreadTransaction>,
remove_txs: Vec<u32>,
) -> Result<GbtResult> {
trace!("update: Current State {:#?}", self.thread_transactions);
run_task(Arc::clone(&self.thread_transactions), move |map| {
for tx in new_txs {