Skip to content

Commit 25df9f1

Browse files
committed
Stop checking ChannelLiquidity's in-memory size
We generally expect `ChannelLiquidity` to be exactly three cache lines to ensure the first bytes we need are all one one cache line. This improves performance very marginally on some machines, but the assertions that this is true do not work on some Android 32-bit machines due to differing `Duration` sizes. Here we simply remove the assertions to fix build on platforms where the struct size isn't exactly on cache lines. This may marginally harm performance but it shouldn't be that critical. Fixes #3415
1 parent 1b281f1 commit 25df9f1

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

lightning/src/routing/scoring.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -903,16 +903,6 @@ struct ChannelLiquidity {
903903
offset_history_last_updated: Duration,
904904
}
905905

906-
// Check that the liquidity HashMap's entries sit on round cache lines.
907-
//
908-
// Specifically, the first cache line will have the key, the liquidity offsets, and the total
909-
// points tracked in the historical tracker.
910-
//
911-
// The next two cache lines will have the historical points, which we only access last during
912-
// scoring, followed by the last_updated `Duration`s (which we do not need during scoring).
913-
const _LIQUIDITY_MAP_SIZING_CHECK: usize = 192 - ::core::mem::size_of::<(u64, ChannelLiquidity)>();
914-
const _LIQUIDITY_MAP_SIZING_CHECK_2: usize = ::core::mem::size_of::<(u64, ChannelLiquidity)>() - 192;
915-
916906
/// A snapshot of [`ChannelLiquidity`] in one direction assuming a certain channel capacity.
917907
struct DirectedChannelLiquidity<L: Deref<Target = u64>, HT: Deref<Target = HistoricalLiquidityTracker>, T: Deref<Target = Duration>> {
918908
min_liquidity_offset_msat: L,

0 commit comments

Comments
 (0)