fixed debugging
This commit is contained in:
parent
c74784ef32
commit
c2f907a36a
|
|
@ -38,9 +38,17 @@ pub async fn create_genesis_block(
|
|||
return;
|
||||
}
|
||||
};
|
||||
handle_response_and_save_torrent(0, &db, torrent, wallet_key, map.clone(), false)
|
||||
.await
|
||||
.ok();
|
||||
handle_response_and_save_torrent(
|
||||
0,
|
||||
&db,
|
||||
torrent,
|
||||
wallet_key,
|
||||
map.clone(),
|
||||
false,
|
||||
false,
|
||||
)
|
||||
.await
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ pub async fn save_new_blocks(
|
|||
wallet_key,
|
||||
params.map.clone(),
|
||||
true,
|
||||
true,
|
||||
)
|
||||
.await
|
||||
{
|
||||
|
|
@ -191,6 +192,7 @@ pub async fn save_new_blocks(
|
|||
wallet_key,
|
||||
params.map.clone(),
|
||||
true,
|
||||
true,
|
||||
)
|
||||
.await?;
|
||||
if get_height(¶ms.db) <= local_height_before {
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ async fn replay_staged_torrents(params: &OrphanCheckup2, wallet_key: &str) -> Re
|
|||
wallet_key,
|
||||
params.map.clone(),
|
||||
true,
|
||||
true,
|
||||
)
|
||||
.await
|
||||
{
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ pub async fn node_syncing(
|
|||
wallet_key,
|
||||
map.clone(),
|
||||
false,
|
||||
false,
|
||||
)
|
||||
.await
|
||||
{
|
||||
|
|
|
|||
|
|
@ -132,6 +132,15 @@ pub async fn torrent_submission(
|
|||
let reorganizing = is_reorganizing_mode();
|
||||
let process_now = !syncing && !reorganizing && height == expected_height;
|
||||
|
||||
if height < expected_height && !(height > 0 && within_orphan_window(local_height, height)) {
|
||||
// Far-stale torrents cannot affect the orphan window. Ignore them
|
||||
// before parsing or staging so syncing peers do not flood old
|
||||
// metadata into local replay storage.
|
||||
return TorrentSubmissionOutcome::Accepted(RpcResponse::Binary(
|
||||
"Torrent ignored as stale.".as_bytes().to_vec(),
|
||||
));
|
||||
}
|
||||
|
||||
// The sender receives an acknowledgement for staging even when the
|
||||
// torrent cannot be processed immediately.
|
||||
let staged_response = if syncing {
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ pub async fn handle_response_and_save_torrent(
|
|||
wallet_key: &str,
|
||||
map: Arc<Mutex<Command>>,
|
||||
allow_during_reorg: bool,
|
||||
rebroadcast: bool,
|
||||
) -> Result<(), String> {
|
||||
let Some((torrent, staged_path)) =
|
||||
stage_and_verify_torrent(height, db, torrent, wallet_key, true).await?
|
||||
|
|
@ -58,9 +59,11 @@ pub async fn handle_response_and_save_torrent(
|
|||
)
|
||||
.await?;
|
||||
|
||||
// A requested torrent is only forwarded after this node has the
|
||||
// complete validated block available for piece requests.
|
||||
broadcast_new_torrent_to_peers(height, &torrent_bytes, map).await;
|
||||
if rebroadcast {
|
||||
// A requested torrent is only forwarded after this node has the
|
||||
// complete validated block available for piece requests.
|
||||
broadcast_new_torrent_to_peers(height, &torrent_bytes, map).await;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue