docs: line up comments with code

This commit is contained in:
Greg Heartsfield 2022-02-17 16:18:05 -06:00
parent f2001dc34a
commit f8b1fe5035
2 changed files with 7 additions and 4 deletions

View File

@ -148,6 +148,8 @@ impl Event {
// ** [0, pubkey-hex-string, created-at-num, kind-num, tags-array-of-arrays, content-string]
// * serialize with no spaces/newlines
let c_opt = self.to_canonical();
debug!("Canonical: {:?}", &c_opt);
debug!("Canonical: {}", c_opt.as_ref().unwrap());
if c_opt.is_none() {
debug!("event could not be canonicalized");
return false;
@ -156,6 +158,7 @@ impl Event {
// * compute the sha256sum.
let digest: sha256::Hash = sha256::Hash::hash(c.as_bytes());
let hex_digest = format!("{:x}", digest);
debug!("hex is: {}", hex_digest);
// * ensure the id matches the computed sha256sum.
if self.id != hex_digest {
debug!("event id does not match digest");

View File

@ -375,10 +375,6 @@ async fn nostr_server(
// Create channel for receiving NOTICEs
let (notice_tx, mut notice_rx) = mpsc::channel::<String>(32);
// maintain a hashmap of a oneshot channel for active subscriptions.
// when these subscriptions are cancelled, make a message
// available to the executing query so it knows to stop.
// last time this client sent data
let mut last_message_time = Instant::now();
@ -391,7 +387,11 @@ async fn nostr_server(
let start = tokio::time::Instant::now() + default_ping_dur;
let mut ping_interval = tokio::time::interval_at(start, default_ping_dur);
// maintain a hashmap of a oneshot channel for active subscriptions.
// when these subscriptions are cancelled, make a message
// available to the executing query so it knows to stop.
let mut running_queries: HashMap<String, oneshot::Sender<()>> = HashMap::new();
// for stats, keep track of how many events the client published,
// and how many it received from queries.
let mut client_published_event_count: usize = 0;