use util::ser::{Writeable, Readable, Writer};
use util::logger::Logger;
use util::events::{MessageSendEvent, MessageSendEventsProvider};
-use util::scid_utils::{block_from_scid, scid_from_parts};
+use util::scid_utils::{block_from_scid, scid_from_parts, MAX_SCID_BLOCK};
use std::{cmp, fmt};
use std::sync::{RwLock, RwLockReadGuard};
let network_graph = self.network_graph.read().unwrap();
- let start_scid = scid_from_parts(msg.first_blocknum, 0, 0);
+ let start_scid = scid_from_parts(msg.first_blocknum as u64, 0, 0);
// We receive valid queries with end_blocknum that would overflow SCID conversion.
// Manually cap the ending block to avoid this overflow.
- let exclusive_end_scid = scid_from_parts(cmp::min(msg.end_blocknum(), 0xffffff), 0, 0);
+ let exclusive_end_scid = scid_from_parts(cmp::min(msg.end_blocknum() as u64, MAX_SCID_BLOCK), 0, 0);
// Per spec, we must reply to a query. Send an empty message when things are invalid.
if msg.chain_hash != network_graph.genesis_hash || start_scid.is_err() || exclusive_end_scid.is_err() {
drop(network_graph);
let mut pending_events = self.pending_events.lock().unwrap();
- let mut batch_index = 0;
let batch_count = batches.len();
- for batch in batches.into_iter() {
+ for (batch_index, batch) in batches.into_iter().enumerate() {
// Per spec, the initial first_blocknum needs to be <= the query's first_blocknum.
// Use the query's values since we don't use pre-processed reply ranges.
let first_blocknum = if batch_index == 0 {
short_channel_ids: batch,
}
});
-
- batch_index += 1;
}
Ok(())