diff --git a/third_party/silentdragonxlite/silentdragonxlite-cli/lib/src/grpcconnector.rs b/third_party/silentdragonxlite/silentdragonxlite-cli/lib/src/grpcconnector.rs index 79c2401..57c35ce 100644 --- a/third_party/silentdragonxlite/silentdragonxlite-cli/lib/src/grpcconnector.rs +++ b/third_party/silentdragonxlite/silentdragonxlite-cli/lib/src/grpcconnector.rs @@ -11,7 +11,7 @@ use tokio_rustls::{rustls::ClientConfig}; use tonic::{Request}; use threadpool::ThreadPool; -use std::sync::mpsc::channel; +use std::sync::mpsc::{channel, sync_channel}; use crate::PubCertificate; use crate::grpc_client::compact_tx_streamer_client::CompactTxStreamerClient; @@ -113,7 +113,7 @@ where F : Fn(&[u8], u64) { let request = Request::new(BlockRange { start: Some(bs), end: Some(be) }); - let (tx, rx) = channel::>(); + let (tx, rx) = sync_channel::>(2048); let (ftx, frx) = channel(); pool.execute(move || { diff --git a/third_party/silentdragonxlite/silentdragonxlite-cli/lib/src/lightclient.rs b/third_party/silentdragonxlite/silentdragonxlite-cli/lib/src/lightclient.rs index 755f342..424faa5 100644 --- a/third_party/silentdragonxlite/silentdragonxlite-cli/lib/src/lightclient.rs +++ b/third_party/silentdragonxlite/silentdragonxlite-cli/lib/src/lightclient.rs @@ -1660,8 +1660,9 @@ pub fn start_mempool_monitor(lc: Arc) -> Result<(), String> { // get_block_range streams an ENTIRE range over ONE gRPC connection, so the batch size is // the dominant factor in how many TCP connections a sync opens. The old 1000 meant ~1300 // connections for a full sync, which on Windows exhausted socket buffers (WSAENOBUFS / os - // error 10055). A large batch (25k) cuts that ~50x (~52 connections for a full sync) with - // no extra memory — blocks are still streamed + scanned incrementally, not buffered. + // error 10055). A large batch (25k) cuts that ~50x (~52 connections for a full sync). Blocks + // are now buffered up to 2048 deep (bounded backpressure, C240), still one connection per + // 25k batch; scan_batch_size must NOT shrink or Windows WSAENOBUFS returns. let scan_batch_size = 25000; let mut end_height = std::cmp::min(last_scanned_height + scan_batch_size, latest_block);