Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Longarithm committed Dec 11, 2023
1 parent 8b65e55 commit df76410
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion chain/chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6335,7 +6335,7 @@ impl Debug for BlockCatchUpRequest {
pub struct BlockCatchUpResponse {
pub sync_hash: CryptoHash,
pub block_hash: CryptoHash,
pub results: Vec<Result<(ShardId, ShardUpdateResult), Error>>,
pub results: Vec<(ShardId, Result<ShardUpdateResult, Error>)>,
}

/// Helper to track blocks catch up
Expand Down
5 changes: 4 additions & 1 deletion chain/client/src/client_actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use crate::{metrics, StatusResponse, SyncAdapter};
use actix::{Actor, Addr, Arbiter, AsyncContext, Context, Handler};
use actix_rt::ArbiterHandle;
use chrono::{DateTime, Utc};
use itertools::Itertools;
use near_async::messaging::{CanSend, Sender};
use near_chain::chain::{
ApplyStatePartsRequest, ApplyStatePartsResponse, BlockCatchUpRequest, BlockCatchUpResponse,
Expand Down Expand Up @@ -1889,7 +1890,9 @@ impl Handler<WithSpanContext<BlockCatchUpResponse>> for ClientActor {
self.client.catchup_state_syncs.get_mut(&msg.sync_hash)
{
assert!(blocks_catch_up_state.scheduled_blocks.remove(&msg.block_hash));
blocks_catch_up_state.processed_blocks.insert(msg.block_hash, msg.results);
blocks_catch_up_state
.processed_blocks
.insert(msg.block_hash, msg.results.into_iter().map(|res| res.1).collect_vec());
} else {
panic!("block catch up processing result from unknown sync hash");
}
Expand Down
6 changes: 5 additions & 1 deletion chain/client/src/test_utils/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::sync::{Arc, RwLock};

use crate::Client;
use actix_rt::{Arbiter, System};
use itertools::Itertools;
use near_chain::chain::{do_apply_chunks, BlockCatchUpRequest};
use near_chain::resharding::StateSplitRequest;
use near_chain::test_utils::{wait_for_all_blocks_in_processing, wait_for_block_in_processing};
Expand Down Expand Up @@ -242,7 +243,10 @@ pub fn run_catchup(
)?;
let mut catchup_done = true;
for msg in block_messages.write().unwrap().drain(..) {
let results = do_apply_chunks(msg.block_hash, msg.block_height, msg.work);
let results = do_apply_chunks(msg.block_hash, msg.block_height, msg.work)
.into_iter()
.map(|res| res.1)
.collect_vec();
if let Some((_, _, blocks_catch_up_state)) =
client.catchup_state_syncs.get_mut(&msg.sync_hash)
{
Expand Down

0 comments on commit df76410

Please sign in to comment.