Skip to content

Commit 84d5ee7

Browse files
authored
Merge pull request #115 from heliaxdev/yuji/wait-more
wait for building tx failure
2 parents 19fbe6f + 86362ca commit 84d5ee7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

workload/src/task.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ pub trait TaskContext {
165165
) -> Result<Height, TaskError> {
166166
let retry_config = utils::retry_config();
167167

168+
let height = utils::get_block_height(sdk, retry_config).await?;
168169
let result = match self.build_tx(sdk).await {
169170
Ok((tx, signing_data, tx_args)) => {
170171
utils::execute_tx(sdk, tx, signing_data, &tx_args).await
@@ -173,16 +174,20 @@ pub trait TaskContext {
173174
};
174175

175176
let epoch = match result {
177+
Ok(_) => None,
176178
Err(TaskError::Execution { height, .. })
177179
| Err(TaskError::InsufficientGas { height, .. }) => {
178180
utils::wait_block_settlement(sdk, height, retry_config).await;
179-
utils::get_masp_epoch_at_height(sdk, height, retry_config).await?
181+
Some(utils::get_masp_epoch_at_height(sdk, height, retry_config).await?)
182+
}
183+
Err(_) => {
184+
utils::wait_block_settlement(sdk, height + 1, retry_config).await;
185+
Some(utils::get_masp_epoch(sdk, retry_config).await?)
180186
}
181-
_ => utils::get_masp_epoch(sdk, retry_config).await?,
182187
};
183188

184189
result.map_err(|err| {
185-
if epoch == start_epoch {
190+
if epoch == Some(start_epoch) {
186191
err
187192
} else {
188193
TaskError::InvalidShielded {

0 commit comments

Comments
 (0)