web3coach / the-blockchain-bar

The source-code for: "Build a Blockchain from Scratch in Go" eBook.
https://web3.coach
GNU Lesser General Public License v3.0
499 stars 184 forks source link

Add Account/Version to Peer Status, Fix Miner #17

Closed cmaahs closed 3 years ago

cmaahs commented 3 years ago

In the output below you will see for the node itself a key of 'node_version' and 'account' have been added. Similarly under the 'peers_known' list, 'account' has been made to display correctly, and a 'node_version' has been added. You can see here that some of the peer data came from the bootstrap node, and as such doesn't contain the 'node_version' data.

curl -Ls -X GET http://73.94.107.106:8995/node/status | jq .

{
  "block_hash": "0000007414e771708a2f5e2cdd16e29dd2b2a5a858bbb5341a4eb8d855fc8861",
  "block_number": 19,
  "peers_known": {
    "73.94.107.106:8996": {
      "ip": "73.94.107.106",
      "port": 8996,
      "is_bootstrap": false,
      "account": "0xf04679700642fd1455782e1acc37c314aab1a847",
      "node_version": "1.3.1-alpha  TX Gas"
    },
    "73.94.107.106:8997": {
      "ip": "73.94.107.106",
      "port": 8997,
      "is_bootstrap": false,
      "account": "0xdd1fbd71d7f78a810ae10829220fbb7bd2f1818b",
      "node_version": ""
    },
    "node.tbb.web3.coach:443": {
      "ip": "node.tbb.web3.coach",
      "port": 443,
      "is_bootstrap": true,
      "account": "0x09ee50f2f37fcba1845de6fe5c762e83e65e755c",
      "node_version": ""
    }
  },
  "pending_txs": [],
  "node_version": "1.3.1-alpha  TX Gas",
  "account": "0xdd1fbd71d7f78a810ae10829220fbb7bd2f1818b"
}
EnchanterIO commented 3 years ago

Deployed new changes! :)

Screenshot from 2021-05-23 13-09-55