Skip to content

Commit

Permalink
axon wait for header sync when sending
Browse files Browse the repository at this point in the history
  • Loading branch information
blckngm committed Dec 21, 2023
1 parent 5a605e7 commit 572c2ff
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ibc-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
SRC_DIR: ${{ github.workspace }}/ibc-test-src
# https://github.com/axonweb3/axon/commits/forcerelay-dev
AXON_COMMIT: forcerelay-dev
IBC_CONTRACT_COMMIT: 3ae160a918b49c7f3ad8a7ff7138894eaacfc3fd
IBC_CONTRACT_COMMIT: d33d0ee32b0b89aafac885fd3f68946ea1f2dc68
CELL_EMITTER_COMMIT: 0a897111b389472a078512815d293703910c25d5
strategy:
fail-fast: false
Expand Down
16 changes: 16 additions & 0 deletions crates/relayer/src/chain/axon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,22 @@ macro_rules! convert {

impl AxonChain {
fn send_message(&mut self, message: Any) -> Result<IbcEventWithHeight, Error> {
loop {
match self.send_message_inner(message.clone()) {
Ok(e) => return Ok(e),
Err(e) => {
if e.to_string().contains("reverted: getHeader") {
std::thread::sleep(Duration::from_secs(5));
tracing::info!("getHeader failed, waiting for header sync");
continue;
}
return Err(e);
}
}
}
}

fn send_message_inner(&mut self, message: Any) -> Result<IbcEventWithHeight, Error> {
use contract::*;
let msg = message.clone();
let tx_receipt: eyre::Result<_> = match msg.type_url.as_str() {
Expand Down

0 comments on commit 572c2ff

Please sign in to comment.