Skip to content

Commit

Permalink
fix: signer raised error when register_signature returned 202
Browse files Browse the repository at this point in the history
  • Loading branch information
Alenar committed Oct 10, 2024
1 parent dbecb22 commit be2657a
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion mithril-signer/src/services/aggregator_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ impl AggregatorClient for AggregatorHTTPClient {

match response {
Ok(response) => match response.status() {
StatusCode::CREATED => Ok(()),
StatusCode::CREATED | StatusCode::ACCEPTED => Ok(()),
StatusCode::GONE => {
debug!(self.logger, "Aggregator already certified that message"; "signed_entity_type" => ?signed_entity_type);
Ok(())
Expand Down Expand Up @@ -896,6 +896,31 @@ mod tests {
register_signatures.expect("unexpected error");
}

#[tokio::test]
async fn test_register_signatures_ok_202() {
let single_signatures = fake_data::single_signatures((1..5).collect());
let (server, config, api_version_provider) = setup_test();
let _server_mock = server.mock(|when, then| {
when.method(POST).path("/register-signatures");
then.status(202);
});
let certificate_handler = AggregatorHTTPClient::new(
config.aggregator_endpoint,
config.relay_endpoint,
Arc::new(api_version_provider),
None,
TestLogger::stdout(),
);
let register_signatures = certificate_handler
.register_signatures(
&SignedEntityType::dummy(),
&single_signatures,
&ProtocolMessage::default(),
)
.await;
register_signatures.expect("unexpected error");
}

#[tokio::test]
async fn test_register_signatures_ko_412() {
let (server, config, api_version_provider) = setup_test();
Expand Down

0 comments on commit be2657a

Please sign in to comment.