Kaynağa Gözat

minerd/rpc: fixed pending requests check

skoupidi 1 yıl önce
ebeveyn
işleme
a076201e7b
1 değiştirilmiş dosya ile 2 ekleme ve 1 silme
  1. 2 1
      bin/minerd/src/rpc.rs

+ 2 - 1
bin/minerd/src/rpc.rs

@@ -115,6 +115,7 @@ impl MinerNode {
             error!(target: "minerd::rpc", "Failed mining block {} with error: {}", block_hash, e);
             error!(target: "minerd::rpc", "Failed mining block {} with error: {}", block_hash, e);
             return server_error(RpcError::MiningFailed, id, None)
             return server_error(RpcError::MiningFailed, id, None)
         }
         }
+        info!(target: "minerd::rpc", "Mined block {} with nonce: {}", block_hash, block.header.nonce);
 
 
         // Return block nonce
         // Return block nonce
         JsonResponse::new(JsonValue::Number(block.header.nonce as f64), id).into()
         JsonResponse::new(JsonValue::Number(block.header.nonce as f64), id).into()
@@ -124,7 +125,7 @@ impl MinerNode {
     async fn abort_pending(&self, id: u16) -> Option<JsonResult> {
     async fn abort_pending(&self, id: u16) -> Option<JsonResult> {
         // Check if a pending request is being processed
         // Check if a pending request is being processed
         info!(target: "minerd::rpc", "Checking if a pending request is being processed...");
         info!(target: "minerd::rpc", "Checking if a pending request is being processed...");
-        if self.stop_signal.receiver_count() == 0 {
+        if self.stop_signal.receiver_count() <= 1 {
             info!(target: "minerd::rpc", "No pending requests!");
             info!(target: "minerd::rpc", "No pending requests!");
             return None
             return None
         }
         }