Skip to content

Commit 5c3f318

Browse files
committed
chore: uncomment logging
1 parent a2a17b2 commit 5c3f318

File tree

1 file changed

+45
-46
lines changed

1 file changed

+45
-46
lines changed

packages/rs-sdk/src/core/transaction.rs

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ impl Sdk {
6969
) -> Result<AssetLockProof, Error> {
7070
let transaction_id = transaction.txid();
7171

72-
// let _span = tracing::debug_span!(
73-
// "wait_for_asset_lock_proof_for_transaction",
74-
// transaction_id = transaction_id.to_string(),
75-
// )
76-
// .entered();
77-
//
78-
// tracing::debug!("waiting for messages from stream");
72+
let _span = tracing::debug_span!(
73+
"wait_for_asset_lock_proof_for_transaction",
74+
transaction_id = transaction_id.to_string(),
75+
)
76+
.entered();
77+
78+
tracing::debug!("waiting for messages from stream");
7979

8080
// Define an inner async block to handle the stream processing.
8181
let stream_processing = async {
@@ -98,10 +98,10 @@ impl Sdk {
9898
instant_send_lock_messages,
9999
),
100100
) => {
101-
// tracing::debug!(
102-
// "received {} instant lock message(s)",
103-
// instant_send_lock_messages.messages.len()
104-
// );
101+
tracing::trace!(
102+
"received {} instant lock message(s)",
103+
instant_send_lock_messages.messages.len()
104+
);
105105

106106
for instant_lock_bytes in instant_send_lock_messages.messages {
107107
let instant_lock =
@@ -120,29 +120,28 @@ impl Sdk {
120120
output_index: 0,
121121
});
122122

123-
// tracing::debug!(
124-
// ?asset_lock_proof,
125-
// "instant lock is matching to the broadcasted transaction, returning instant asset lock proof"
126-
// );
123+
tracing::trace!(
124+
?asset_lock_proof,
125+
"instant lock is matching to the broadcasted transaction, returning instant asset lock proof"
126+
);
127127

128128
return Ok(asset_lock_proof);
129+
} else {
130+
tracing::debug!(
131+
"instant lock is not matching, waiting for the next message"
132+
);
129133
}
130-
// else {
131-
// tracing::debug!(
132-
// "instant lock is not matching, waiting for the next message"
133-
// );
134-
// }
135134
}
136135
}
137136
Some(transactions_with_proofs_response::Responses::RawMerkleBlock(
138137
raw_merkle_block,
139138
)) => {
140-
// tracing::debug!("received merkle block");
139+
tracing::trace!("received merkle block");
141140

142141
let merkle_block =
143142
MerkleBlock::consensus_decode(&mut raw_merkle_block.as_slice())
144143
.map_err(|e| {
145-
// tracing::error!("can't decode merkle block: {}", e);
144+
tracing::error!("can't decode merkle block: {}", e);
146145

147146
Error::CoreError(e.into())
148147
})?;
@@ -154,16 +153,16 @@ impl Sdk {
154153

155154
// Continue receiving messages until we find the transaction
156155
if !matches.contains(&transaction_id) {
157-
// tracing::debug!(
158-
// "merkle block doesn't contain the transaction, waiting for the next message"
159-
// );
156+
tracing::debug!(
157+
"merkle block doesn't contain the transaction, waiting for the next message"
158+
);
160159

161160
continue;
162161
}
163162

164-
// tracing::debug!(
165-
// "merkle block contains the transaction, obtaining core chain locked height"
166-
// );
163+
tracing::trace!(
164+
"merkle block contains the transaction, obtaining core chain locked height"
165+
);
167166

168167
// TODO: This a temporary implementation until we have headers stream running in background
169168
// so we can always get actual height and chain locks
@@ -191,15 +190,15 @@ impl Sdk {
191190
break;
192191
}
193192

194-
// tracing::trace!("the transaction is on height {} but not chainlocked. try again in 1 sec", height);
193+
tracing::trace!("the transaction is on height {} but not chainlocked. try again in 1 sec", height);
195194

196195
sleep(Duration::from_secs(1)).await;
197196
}
198197

199-
// tracing::debug!(
200-
// "the transaction is chainlocked on height {}, waiting platform for reaching the same core height",
201-
// core_chain_locked_height
202-
// );
198+
tracing::trace!(
199+
"the transaction is chainlocked on height {}, waiting platform for reaching the same core height",
200+
core_chain_locked_height
201+
);
203202

204203
// Wait until platform chain is on the block's chain locked height
205204
loop {
@@ -210,11 +209,11 @@ impl Sdk {
210209
break;
211210
}
212211

213-
// tracing::trace!(
214-
// "platform chain locked core height {} but we need {}. try again in 1 sec",
215-
// metadata.core_chain_locked_height,
216-
// core_chain_locked_height,
217-
// );
212+
tracing::trace!(
213+
"platform chain locked core height {} but we need {}. try again in 1 sec",
214+
metadata.core_chain_locked_height,
215+
core_chain_locked_height,
216+
);
218217

219218
sleep(Duration::from_secs(1)).await;
220219
}
@@ -227,20 +226,20 @@ impl Sdk {
227226
},
228227
});
229228

230-
// tracing::debug!(
231-
// ?asset_lock_proof,
232-
// "merkle block contains the broadcasted transaction, returning chain asset lock proof"
233-
// );
229+
tracing::trace!(
230+
?asset_lock_proof,
231+
"merkle block contains the broadcasted transaction, returning chain asset lock proof"
232+
);
234233

235234
return Ok(asset_lock_proof);
236235
}
237236
Some(transactions_with_proofs_response::Responses::RawTransactions(_)) => {
238-
// tracing::trace!("received transaction(s), ignoring")
237+
tracing::trace!("received transaction(s), ignoring")
239238
}
240239
None => {
241-
// tracing::trace!(
242-
// "received empty response as a workaround for the bug in tonic, ignoring"
243-
// )
240+
tracing::trace!(
241+
"received empty response as a workaround for the bug in tonic, ignoring"
242+
)
244243
}
245244
}
246245
}

0 commit comments

Comments
 (0)