瀏覽代碼

improved logging for less confusion about networking

tacryt-socryp 6 月之前
父節點
當前提交
c3a0723a31
共有 5 個文件被更改,包括 18 次插入15 次删除
  1. 1 2
      .gitignore
  2. 0 2
      README.md
  3. 2 2
      crates/nockchain-libp2p-io/src/nc.rs
  4. 4 4
      hoon/apps/dumbnet/inner.hoon
  5. 11 5
      hoon/common/tx-engine.hoon

+ 1 - 2
.gitignore

@@ -1,3 +1,4 @@
+.env
 .data.*
 /hoonc
 test-leader
@@ -7,5 +8,3 @@ test-follower
 target
 assets/*.jam
 !crates/nockapp/test-jams
-miner-node
-.env

+ 0 - 2
README.md

@@ -91,8 +91,6 @@ nockchain-wallet import-keys --input keys.export
 
 ## Running Nodes
 
-To run a Nockchain node without mining:
-
 Make sure your current directory is nockchain.
 
 To run a Nockchain node without mining.

+ 2 - 2
crates/nockchain-libp2p-io/src/nc.rs

@@ -229,7 +229,7 @@ pub fn make_libp2p_driver(
                                 tracker.remove_peer(&peer_id);
                             },
                             SwarmEvent::IncomingConnectionError { local_addr, send_back_addr, error, .. } => {
-                               error!("SEvent: Failed incoming connection from {} to {}: {}",
+                               trace!("SEvent: Failed incoming connection from {} to {}: {}",
                                send_back_addr, local_addr, error);
                             },
                             SwarmEvent::Behaviour(NockchainEvent::RequestResponse(Message { connection_id: _, peer, message })) => {
@@ -248,7 +248,7 @@ pub fn make_libp2p_driver(
                                 });
                             },
                             SwarmEvent::OutgoingConnectionError { peer_id, error, .. } => {
-                                error!("Failed outgoing connection to {:?}: {}", peer_id, error);
+                                trace!("Failed outgoing connection to {:?}: {}", peer_id, error);
                             },
                             SwarmEvent::IncomingConnection {
                                 local_addr,

+ 4 - 4
hoon/apps/dumbnet/inner.hoon

@@ -683,15 +683,15 @@
     ++  handle-command
       |=  [now=@da =command:dk]
       ^-  [(list effect:dk) kernel-state:dk]
-      ~>  %slog.[0 (cat 3 'command: ' -.command)]
+      ~>  %slog.[3 (cat 3 'command: ' -.command)]
       ::  ~&  "handling command: {<-.command>}"
       ?:  &(?=(init-command:dk -.command) !init.a.k)
         ::  kernel no longer in init phase, can't do init command
-        ~>  %slog.[0 leaf+"kernel no longer in init phase, can't do init command"]
+        ~>  %slog.[3 leaf+"kernel no longer in init phase, can't do init command"]
         `k
       ?:  &(?=(non-init-command:dk -.command) init.a.k)
         ::  kernel in init phase, can't perform command
-        ~>  %slog.[0 leaf+"kernel is in init phase, can't do non-init command"]
+        ~>  %slog.[3 leaf+"kernel is in init phase, can't do non-init command"]
         `k
       |^
       ?-  -.command
@@ -889,7 +889,7 @@
     ++  handle-fact
       |=  [wir=wire eny=@ our=@ux now=@da =fact:dk]
       ^-  [(list effect:dk) kernel-state:dk]
-      ~>  %slog.[0 (cat 3 'fact: ' +<.fact)]
+      ~>  %slog.[3 (cat 3 'fact: ' +<.fact)]
       ?:  init.a.k
         ::  kernel in init phase, fact ignored
         `k

+ 11 - 5
hoon/common/tx-engine.hoon

@@ -1612,11 +1612,17 @@
       %|
     %+  levy  ~(tap z-by form)
     |=  [=lock =coins]
-    ~&  :*  %based-split-check
-            coins-not-zero+!=(0 coins)
-            coins-based+(^based coins)
-            lock-based+(based:^lock lock)
-        ==
+    =/  based-print
+      ;:  (cury cat 3)
+        'based-split-check: '
+        'coin-not-zero: '
+        ?:(!=(0 coins) 'yes' 'no')
+        ' coins-based: '
+        ?:((^based coins) 'yes' 'no')
+        ' lock-based: '
+        ?:((based:^lock lock) 'yes' 'no')
+      ==
+    ~>  %slog.[3 based-print]
     ?&  !=(0 coins)
         (^based coins)
         (based:^lock lock)