Skip to content

Commit

Permalink
Merge pull request #97 from gregdhill/fix/restart-rpc-error
Browse files Browse the repository at this point in the history
fix: restart clients on any rpc error
  • Loading branch information
gregdhill authored May 10, 2021
2 parents e576e96 + 711e437 commit 4f99696
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions runtime/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ impl Error {
}))) if module == BTC_RELAY_MODULE && error == DUPLICATE_BLOCK_ERROR
)
}

pub fn is_rpc_error(&self) -> bool {
matches!(self, Error::SubxtError(SubxtError::Rpc(_)))
}
}

#[derive(Error, Debug)]
Expand Down
1 change: 1 addition & 0 deletions service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ impl<Config: Clone + Send + 'static, S: Service<Config>> ConnectionManager<Confi
()
}
Err(Error::RuntimeError(RuntimeError::ChannelClosed)) => (),
Err(Error::RuntimeError(err)) if err.is_rpc_error() => (),
Err(err) => return Err(err),
}

Expand Down

0 comments on commit 4f99696

Please sign in to comment.