Ran cargo fmt
This commit is contained in:
parent
ccbed8ec58
commit
0ddfa94b59
@ -1,5 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
u32_hasher_types::{u32hashset_new, U32HasherState}, ThreadTransaction,
|
u32_hasher_types::{u32hashset_new, U32HasherState},
|
||||||
|
ThreadTransaction,
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
cmp::Ordering,
|
cmp::Ordering,
|
||||||
@ -75,15 +76,8 @@ impl Ord for AuditTransaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn calc_fee_rate(
|
fn calc_fee_rate(fee: f64, vsize: u32) -> f64 {
|
||||||
fee: f64,
|
fee / (if vsize == 0 { 1.0 } else { f64::from(vsize) })
|
||||||
vsize: u32,
|
|
||||||
) -> f64 {
|
|
||||||
fee / (if vsize == 0 {
|
|
||||||
1.0
|
|
||||||
} else {
|
|
||||||
f64::from(vsize)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AuditTransaction {
|
impl AuditTransaction {
|
||||||
@ -149,7 +143,10 @@ impl AuditTransaction {
|
|||||||
/// Safety: This function must NEVER set score to NaN.
|
/// Safety: This function must NEVER set score to NaN.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn calc_new_score(&mut self) {
|
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]
|
#[inline]
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#![allow(clippy::cast_sign_loss)]
|
#![allow(clippy::cast_sign_loss)]
|
||||||
#![allow(clippy::float_cmp)]
|
#![allow(clippy::float_cmp)]
|
||||||
|
|
||||||
use napi::bindgen_prelude::{Result};
|
use napi::bindgen_prelude::Result;
|
||||||
use napi_derive::napi;
|
use napi_derive::napi;
|
||||||
use thread_transaction::ThreadTransaction;
|
use thread_transaction::ThreadTransaction;
|
||||||
use tracing::{debug, info, trace};
|
use tracing::{debug, info, trace};
|
||||||
@ -88,7 +88,11 @@ impl GbtGenerator {
|
|||||||
///
|
///
|
||||||
/// Rejects if the thread panics or if the Mutex is poisoned.
|
/// Rejects if the thread panics or if the Mutex is poisoned.
|
||||||
#[napi]
|
#[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);
|
trace!("update: Current State {:#?}", self.thread_transactions);
|
||||||
run_task(Arc::clone(&self.thread_transactions), move |map| {
|
run_task(Arc::clone(&self.thread_transactions), move |map| {
|
||||||
for tx in new_txs {
|
for tx in new_txs {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user