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.
#[allow(clippy::too_many_lines)]
#[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 mempool_stack: Vec<u32> = Vec::with_capacity(STARTING_CAPACITY);
let mut clusters: Vec<Vec<u32>> = Vec::new();
@ -207,11 +207,11 @@ pub fn gbt(mempool: &mut ThreadTransactionsMap) -> Option<GbtResult> {
}
}
Some(GbtResult {
GbtResult {
blocks,
clusters,
rates,
})
}
}
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()
.map_err(|_| napi::Error::from_reason("THREAD_TRANSACTIONS Mutex poisoned"))?;
callback(&mut map);
gbt::gbt(&mut map).ok_or_else(|| napi::Error::from_reason("gbt failed"))
Ok(gbt::gbt(&mut map))
});
handle