global: snapshot

This commit is contained in:
nym21
2026-03-04 17:10:15 +01:00
parent 891f0dad9e
commit 9e23de4ba1
313 changed files with 9087 additions and 4918 deletions
@@ -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);