Skip to content

Commit

Permalink
add debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Nov 24, 2024
1 parent 489bc62 commit 205e45f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/ckb/tests/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,16 @@ impl Actor for MockChainActor {
}
}
TraceTx(tx, reply_port) => {
eprintln!("debug yukang here ...");
match state.tx_status.get(&tx.tx_hash).cloned() {
Some((tx_view, status)) => {
eprintln!("got here .......: {:?}", status);
reply_trace_tx(Some(tx_view), status, reply_port);
}
// The transaction is not found in the tx_status, we need to wait for the
// tx notification from the mock chain actor.
None => {
eprintln!("now ............................");
self.start_trace_tx_replier(
myself,
tx.tx_hash,
Expand Down
13 changes: 11 additions & 2 deletions src/fiber/tests/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,9 @@ async fn establish_channel_between_nodes(
.get_tx_from_hash(funding_tx_outpoint.tx_hash())
.await
.expect("tx found");

let res = node_a.submit_tx(funding_tx.clone()).await;
eprintln!("yukang submit_tx from node_a: {:?}", res);
(new_channel_id, funding_tx)
}

Expand Down Expand Up @@ -1001,7 +1004,7 @@ async fn create_3_nodes_with_established_channel(
) -> (NetworkNode, NetworkNode, NetworkNode, Hash256, Hash256) {
let [mut node_a, mut node_b, mut node_c] = NetworkNode::new_n_interconnected_nodes().await;

let (channel_id_ab, _funding_tx_ab) = establish_channel_between_nodes(
let (channel_id_ab, funding_tx_ab) = establish_channel_between_nodes(
&mut node_a,
&mut node_b,
channel_1_amount_a,
Expand All @@ -1010,7 +1013,7 @@ async fn create_3_nodes_with_established_channel(
)
.await;

let (channel_id_bc, _funding_tx_bc) = establish_channel_between_nodes(
let (channel_id_bc, funding_tx_bc) = establish_channel_between_nodes(
&mut node_b,
&mut node_c,
channel_2_amount_b,
Expand All @@ -1019,6 +1022,12 @@ async fn create_3_nodes_with_established_channel(
)
.await;

let res = node_a.submit_tx(funding_tx_ab).await;
eprintln!("yukang submit_tx 1: {:?}", res);

let res = node_b.submit_tx(funding_tx_bc).await;
eprintln!("yukang submit_tx 2: {:?}", res);

(node_a, node_b, node_c, channel_id_ab, channel_id_bc)
}

Expand Down

0 comments on commit 205e45f

Please sign in to comment.