Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ sysinfo = { version = "=0.30", optional = true }
reqwest = { version = "=0.12", optional = true, features = ["json"] }

# Cross-platform optional deps (top-level so Windows release builds match Linux defaults).
zstd = { version = "=0.13", optional = true }
zstd = { version = "=0.14", optional = true }
notify = { version = "=6.1", optional = true }
iroh = { version = "=0.95", optional = true }
quinn = { version = "=0.11", optional = true }
Expand Down
10 changes: 6 additions & 4 deletions src/module/api/node_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,10 +561,12 @@ impl NodeAPI for NodeApiImpl {
.transactions()
.get_metadata(&txid)
.map_err(|e| ModuleError::op_err("Failed to get tx metadata", e))?;
Ok(metadata.map(|metadata| crate::module::traits::TxBlockMetadata {
block_hash: metadata.block_hash,
block_height: metadata.block_height,
}))
Ok(
metadata.map(|metadata| crate::module::traits::TxBlockMetadata {
block_hash: metadata.block_hash,
block_height: metadata.block_height,
}),
)
}
})
.await
Expand Down
15 changes: 9 additions & 6 deletions src/module/api/node_api_ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,15 @@ impl NodeAPI for NodeApiIpc {
async fn get_mempool_fee_rate_summary(
&self,
) -> Result<crate::module::traits::MempoolFeeRateSummary, ModuleError> {
self.request(RequestPayload::GetMempoolFeeRateSummary, |payload| match payload {
ResponsePayload::MempoolFeeRateSummary(summary) => Ok(summary),
_ => Err(ModuleError::OperationError(
"Unexpected response type".to_string(),
)),
})
self.request(
RequestPayload::GetMempoolFeeRateSummary,
|payload| match payload {
ResponsePayload::MempoolFeeRateSummary(summary) => Ok(summary),
_ => Err(ModuleError::OperationError(
"Unexpected response type".to_string(),
)),
},
)
.await
}

Expand Down
5 changes: 4 additions & 1 deletion src/network/module_registry_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ async fn payment_is_released(
.map_err(|error| anyhow::anyhow!("paid GetModule requires blvm-payment: {error}"))?;
let value: serde_json::Value = serde_json::from_slice(&response)
.map_err(|error| anyhow::anyhow!("blvm-payment getpaymentstate: {error}"))?;
let state = value.get("state").and_then(|item| item.as_str()).unwrap_or("");
let state = value
.get("state")
.and_then(|item| item.as_str())
.unwrap_or("");
Ok(state == "settled" || state == "in_mempool")
}

Expand Down
3 changes: 1 addition & 2 deletions src/node/parallel_ibd/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1655,8 +1655,7 @@ impl MemoryGuard {
// A Dedicated latch then reserves a 16 GiB UTXO cache and a ~47 GiB RSS
// budget on top of that full swap (testnet4 av2, 2026-10-27: 1 GiB swap
// free, cache latched at 16384 MiB).
let detected =
Self::detect_workload_class(total_mb, available_mb, ctx.ibd_dedicated);
let detected = Self::detect_workload_class(total_mb, available_mb, ctx.ibd_dedicated);
let wc = Self::workload_for_startup_swap(
detected,
startup_swap_total_mb,
Expand Down
35 changes: 20 additions & 15 deletions src/storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1374,14 +1374,9 @@ impl Storage {
let mut walked = 0u64;
let mut target_proof: Option<U256> = None;
loop {
let header = self
.blockstore
.get_header_at_height(h)?
.ok_or_else(|| {
anyhow::anyhow!(
"header {h} missing while summing chainwork through {height}"
)
})?;
let header = self.blockstore.get_header_at_height(h)?.ok_or_else(|| {
anyhow::anyhow!("header {h} missing while summing chainwork through {height}")
})?;
let actual = self.chain().calculate_hash(&header);
if actual != expected_hash {
anyhow::bail!(
Expand All @@ -1399,7 +1394,11 @@ impl Storage {
return Ok((above.saturating_add(proof), own, walked));
}
if let Some(prev) = self.chain().get_chainwork(&header.prev_block_hash)? {
return Ok((prev.saturating_add(proof).saturating_add(above), own, walked));
return Ok((
prev.saturating_add(proof).saturating_add(above),
own,
walked,
));
}
above = above.saturating_add(proof);
expected_hash = header.prev_block_hash;
Expand Down Expand Up @@ -1452,10 +1451,7 @@ mod chainwork_gap_tests {
assert!(storage.chain().get_chainwork(&h1).unwrap().is_none());

storage.ensure_parent_chainwork(&tip_header, 2).unwrap();
storage
.chain()
.update_tip(&h2, &tip_header, 2)
.unwrap();
storage.chain().update_tip(&h2, &tip_header, 2).unwrap();

assert_eq!(storage.chain().get_height().unwrap(), Some(2));
let proof = get_block_proof(bits).unwrap();
Expand All @@ -1471,13 +1467,22 @@ mod chainwork_gap_tests {
let bits = 0x1d00ffffu64;
let parent = header([0u8; 32], bits, 0);
let parent_hash = storage.chain().calculate_hash(&parent);
storage.blockstore.store_header(&parent_hash, &parent).unwrap();
storage
.blockstore
.store_header(&parent_hash, &parent)
.unwrap();
storage.blockstore.store_height(0, &parent_hash).unwrap();

let bogus_prev = [9u8; 32];
assert_ne!(bogus_prev, parent_hash);
let child = header(bogus_prev, bits, 1);
assert!(storage.ensure_parent_chainwork(&child, 1).is_err());
assert!(storage.chain().get_chainwork(&bogus_prev).unwrap().is_none());
assert!(
storage
.chain()
.get_chainwork(&bogus_prev)
.unwrap()
.is_none()
);
}
}