Skip to content

Commit

Permalink
crc: 404 for unknown monitoring request, only increment dkg after sub…
Browse files Browse the repository at this point in the history
…mission
  • Loading branch information
hstove committed Apr 29, 2024
1 parent a5bda55 commit 544fcf6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
19 changes: 17 additions & 2 deletions stacks-signer/src/monitoring/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,24 @@ impl MonitoringServer {
continue;
}

// unknown request, return 200 ok
if request.url() == "/info" {
request
.respond(HttpResponse::from_string(self.get_info_response()))
.expect("Failed to respond to request");
continue;
}

// return 200 OK for "/"
if request.url() == "/" {
request
.respond(HttpResponse::from_string("OK"))
.expect("Failed to respond to request");
continue;
}

// unknown request, return 404
request
.respond(HttpResponse::from_string(self.get_info_response()))
.respond(HttpResponse::from_string("Not Found").with_status_code(404))
.expect("Failed to respond to request");
}
}
Expand Down
2 changes: 1 addition & 1 deletion stacks-signer/src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,11 +1212,11 @@ impl Signer {
debug!("{self}: Received a DKG result, but are in an unsupported epoch. Do not broadcast the transaction ({}).", new_transaction.txid());
return Ok(());
}
crate::monitoring::increment_dkg_votes_submitted();
// For all Pox-4 epochs onwards, broadcast the results also to stackerDB for other signers/miners to observe
signer_transactions.push(new_transaction);
let signer_message = SignerMessage::Transactions(signer_transactions);
self.stackerdb.send_message_with_retry(signer_message)?;
crate::monitoring::increment_dkg_votes_submitted();
info!("{self}: Broadcasted DKG vote transaction ({txid}) to stacker DB");
Ok(())
}
Expand Down

0 comments on commit 544fcf6

Please sign in to comment.