Skip to content

Commit

Permalink
fix: restart clients on any rpc error
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory Hill <[email protected]>
  • Loading branch information
gregdhill committed May 10, 2021
1 parent e576e96 commit 711e437
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 711e437

Please sign in to comment.