You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Filter height and store height sometimes go out of sync in unstable network connections as seen below:
flutter: INFO (sp_backend::api): Nakamoto started
flutter: INFO (client): Initializing client (Signet)..
flutter: INFO (client): Genesis block hash is 00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6
flutter: INFO (client): Found existing store "...../db/.nakamoto/signet/headers.db"
flutter: INFO (client): Store height = 80000
flutter: INFO (client): Loading block headers from store..
flutter: INFO (client): Initializing block filters..
flutter: INFO (client): Found existing store "..../db/.nakamoto/signet/filters.db"
flutter: INFO (client): Filters height = 28000
flutter: INFO (client): Loading filter headers from store..
flutter: INFO (client): Skipping filter header verification (verify = false)
flutter: INFO (client): Loading peer addresses..
flutter: INFO (client): Found existing peer cache "..../db/.nakamoto/signet/peers.json"
flutter: INFO (client): 4575 peer(s) found.. 80 with compact filters support
This presents a problem when you try to request filters using the height returned from handle.get_tip(). The height returned from get_tip() is the block store height. If this height is greater than the filter height, request_filters will fail with an assertion error.
thread '<unnamed>' panicked at ..../.cargo/git/checkouts/nakamoto-75926082020ea03a/08203fd/p2p/src/fsm/cbfmgr.rs:449:9:
assertion failed: *range.end() <= self.filters.height()
How are you running Nakomoto?
Due to constraints on mobile devices, we do not keep Nakomoto running indefinitely in the background. We start it when we want to sync Nakomoto with peers and request filters. See sync code excerpt below:
pub fn sync_blockchain(mut handle: Handle<Waker>) -> Result<()> {
handle.set_timeout(Duration::from_secs(10));
if let Err(_) = handle.wait_for_peers(1, ServiceFlags::NETWORK) {
return Err(Error::msg("Can't connect to peers"));
}
let mut last_height = 0;
loop {
let peer_count = handle.get_peers(ServiceFlags::NETWORK)?;
if peer_count.is_empty() {
continue;
};
let (height, header, _) = handle.get_tip()?;
send_sync_progress(SyncStatus {
peer_count: peer_count.len() as u32,
blockheight: height,
bestblockhash: header.block_hash().to_string(),
});
if last_height == 0 || last_height < height {
last_height = height;
sleep(Duration::from_secs(2));
continue;
}
break;
}
Ok(())
}
How to Reproduce
Run the above code and turn off your internet connection to interrupt the sync process.
I think this problem could be solved by exposing the filter height in get_tip() so we can use that to request filters instead.
The text was updated successfully, but these errors were encountered:
Filter height and store height sometimes go out of sync in unstable network connections as seen below:
This presents a problem when you try to request filters using the height returned from
handle.get_tip()
. The height returned fromget_tip()
is the block store height. If this height is greater than the filter height,request_filters
will fail with an assertion error.Environment
Flutter Linux with flutter_rust_bridge v1
How are you running Nakomoto?
Due to constraints on mobile devices, we do not keep Nakomoto running indefinitely in the background. We start it when we want to sync Nakomoto with peers and request filters. See sync code excerpt below:
How to Reproduce
Run the above code and turn off your internet connection to interrupt the sync process.
I think this problem could be solved by exposing the filter height in
get_tip()
so we can use that to request filters instead.The text was updated successfully, but these errors were encountered: