remove unnecessary option wrapper from gbt return value

This commit is contained in:
Mononaut 2023-06-26 21:13:02 -04:00
parent 1688b7d24e
commit 702c4c123e
No known key found for this signature in database
GPG Key ID: A3F058E41374C04E
2 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ impl Ord for TxPriority {
// TODO: Make gbt smaller to fix these lints. // TODO: Make gbt smaller to fix these lints.
#[allow(clippy::too_many_lines)] #[allow(clippy::too_many_lines)]
#[allow(clippy::cognitive_complexity)] #[allow(clippy::cognitive_complexity)]
pub fn gbt(mempool: &mut ThreadTransactionsMap) -> Option<GbtResult> { pub fn gbt(mempool: &mut ThreadTransactionsMap) -> GbtResult {
let mut audit_pool: AuditPool = u32hashmap_with_capacity(STARTING_CAPACITY); let mut audit_pool: AuditPool = u32hashmap_with_capacity(STARTING_CAPACITY);
let mut mempool_stack: Vec<u32> = Vec::with_capacity(STARTING_CAPACITY); let mut mempool_stack: Vec<u32> = Vec::with_capacity(STARTING_CAPACITY);
let mut clusters: Vec<Vec<u32>> = Vec::new(); let mut clusters: Vec<Vec<u32>> = Vec::new();
@ -207,11 +207,11 @@ pub fn gbt(mempool: &mut ThreadTransactionsMap) -> Option<GbtResult> {
} }
} }
Some(GbtResult { GbtResult {
blocks, blocks,
clusters, clusters,
rates, rates,
}) }
} }
fn next_valid_from_stack<'a>(mempool_stack: &mut Vec<u32>, audit_pool: &'a AuditPool) -> Option<&'a AuditTransaction> { fn next_valid_from_stack<'a>(mempool_stack: &mut Vec<u32>, audit_pool: &'a AuditPool) -> Option<&'a AuditTransaction> {

View File

@ -110,7 +110,7 @@ where
.lock() .lock()
.map_err(|_| napi::Error::from_reason("THREAD_TRANSACTIONS Mutex poisoned"))?; .map_err(|_| napi::Error::from_reason("THREAD_TRANSACTIONS Mutex poisoned"))?;
callback(&mut map); callback(&mut map);
gbt::gbt(&mut map).ok_or_else(|| napi::Error::from_reason("gbt failed")) Ok(gbt::gbt(&mut map))
}); });
handle handle