mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-30 12:18:11 -07:00
global: snapshot
This commit is contained in:
@@ -4,7 +4,10 @@ use brk_types::TxidPrefix;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use super::tx_node::TxNode;
|
||||
use crate::{entry::Entry, types::{PoolIndex, TxIndex}};
|
||||
use crate::{
|
||||
entry::Entry,
|
||||
types::{PoolIndex, TxIndex},
|
||||
};
|
||||
|
||||
/// Type-safe wrapper around Vec<TxNode> that only allows PoolIndex access.
|
||||
pub struct Graph(Vec<TxNode>);
|
||||
|
||||
@@ -9,7 +9,10 @@ const LOOK_AHEAD: usize = 100;
|
||||
/// Packages are sorted by fee rate descending, then placed into blocks.
|
||||
/// When a package doesn't fit, we look ahead for smaller packages that do.
|
||||
/// Atomic packages are never split across blocks.
|
||||
pub fn partition_into_blocks(mut packages: Vec<Package>, num_blocks: usize) -> Vec<Vec<SelectedTx>> {
|
||||
pub fn partition_into_blocks(
|
||||
mut packages: Vec<Package>,
|
||||
num_blocks: usize,
|
||||
) -> Vec<Vec<SelectedTx>> {
|
||||
packages.sort_unstable_by(|a, b| b.fee_rate.cmp(&a.fee_rate));
|
||||
|
||||
let mut blocks: Vec<Vec<SelectedTx>> = Vec::with_capacity(num_blocks);
|
||||
|
||||
Reference in New Issue
Block a user