Skip to content

Commit

Permalink
QT integration
Browse files Browse the repository at this point in the history
  • Loading branch information
bayk committed Dec 6, 2024
1 parent 07bc880 commit 46f0f05
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions chain/src/txhashset/desegmenter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ impl Desegmenter {
+ self.rangeproof_segment_cache.get_received_segments()
+ self.kernel_segment_cache.get_received_segments();

// Expected by QT wallet
info!("PIBD sync progress: {} from {}", received, required);

SyncStatus::TxHashsetPibd {
recieved_segments: received,
total_segments: required,
Expand Down
2 changes: 2 additions & 0 deletions chain/src/txhashset/txhashset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,7 @@ impl<'a> Extension<'a> {
kernels_total: total_kernels,
});
}
// Expected by QT wallet
info!(
"txhashset: verify_kernel_signatures: verified {} signatures from {}",
kern_count, total_kernels
Expand Down Expand Up @@ -2070,6 +2071,7 @@ impl<'a> Extension<'a> {
.map_err(|_| Error::Other("crossbeam runtime error".to_string()))?;
match result {
Ok(proof_count) => {
// Expected by QT wallet
info!(
"txhashset: verify_rangeproofs: verified {} rangeproofs from {}",
proof_count, total_rproofs
Expand Down
1 change: 1 addition & 0 deletions servers/src/mwc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ impl Server {
.name("p2p-server".to_string())
.spawn(move || {
if let Err(e) = p2p_inner.listen() {
// QW wallet using for tracking
error!("P2P server failed with erorr: {:?}", e);
}
})?;
Expand Down
8 changes: 8 additions & 0 deletions servers/src/mwc/sync/body_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ impl BodySync {

// Last few blocks no need to sync, new mined blocks will be synced regular way
if head.height > max_avail_height.saturating_sub(3) {
// Expected by QT wallet
info!(
"synchronized at {} @ {} [{}]",
head.total_difficulty.to_num(),
head.height,
head.last_block_h
);

// sync is done, we are ready.
return Ok(SyncResponse::new(
SyncRequestResponses::BodyReady,
Expand Down
3 changes: 1 addition & 2 deletions servers/src/mwc/sync/header_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,10 @@ impl HeaderSync {

// That is needed for sync tracking
info!(
"Received {} block headers from {}, height {}, remaining {}",
"Received {} block headers from {}, height {}",
bhs.len(),
peer,
bhs[0].height,
0
);

// try to add headers to our header chain
Expand Down
5 changes: 3 additions & 2 deletions servers/src/mwc/sync/state_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,9 +343,10 @@ impl StateSync {
}

if root_hash_peers.is_empty() {
// no peers commited to hash, resetting download process
self.chain.reset_desegmenter();
if other_hashes > 0 {
// no peers commited to hash, resetting download process if we have alternatives.
self.chain.reset_desegmenter();

// Sinse there are other groups, treating that as attack. Banning all supporters
self.ban_this_session(desegmenter, sync_peers);
return SyncResponse::new(
Expand Down
1 change: 1 addition & 0 deletions servers/src/mwc/sync/syncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ impl SyncRunner {

match sync_reponse.response {
SyncRequestResponses::WaitingForPeers => {
info!("Waiting for the peers");
self.sync_state.update(SyncStatus::AwaitingPeers);
self.peers
.set_boost_peers_capabilities(sync_reponse.peers_capabilities);
Expand Down

0 comments on commit 46f0f05

Please sign in to comment.