Ran cargo fmt
This commit is contained in:
		
							parent
							
								
									8cb5d8db3d
								
							
						
					
					
						commit
						8767305966
					
				@ -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]
 | 
			
		||||
 | 
			
		||||
@ -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 {
 | 
			
		||||
 | 
			
		||||
@ -9,4 +9,4 @@ pub struct ThreadTransaction {
 | 
			
		||||
    pub sigops: u32,
 | 
			
		||||
    pub effective_fee_per_vsize: f64,
 | 
			
		||||
    pub inputs: Vec<u32>,
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user