-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[network] add version_string field to PeerInfo #3471
[network] add version_string field to PeerInfo #3471
Conversation
So the RPC API `node.peers` could show the `node_name` in it. Related starcoinorg#3439
I have made a test by joining to $ curl 'http://localhost:9850/' -X POST -H 'Content-Type: application/json' --data-raw '{"method":"node.peers","params":[],"id":6153651,"jsonrpc":"2.0"}' | jq '.result[].version_string'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 7981 100 7917 100 64 1172k 9702 --:--:-- --:--:-- --:--:-- 3896k
"starcoin/1.11.7-rc (build:1.11.7-rc) (mixed-walk-3687)"
"starcoin/1.11.7-rc (build:1.11.7-rc) (depressed-day-1319)" The full output: Click to expand/collapse{
"jsonrpc": "2.0",
"result": [
{
"chain_info": {
"block_info": {
"block_accumulator_info": {
"accumulator_root": "0x64b8909dfbe80bdfb8cf1368c8515848ff1addde9ebc9b6e11a1f1addd049d95",
"frozen_subtree_roots": [
"0xe74e30d9eba4a2be69417860c5772c8aadba73347a46ff84ad1f80d682a5bb77",
"0x7f83553dccc1aa46a9937e16e0729d01c3f8e0e8a7b5d29f5ad200968321e6d7",
"0x02f628579d5bf98aeb7e2ed2cc4614c830bc343d60b4d1ec8366eb1f77a3a58d",
"0xbec354a925b42571863c70e66bcf2e75c24d7065f9319165d69f884c6da015ee",
"0x0c20e407d5bc49abed71c05f454a4c9b5a242ad89a04d5cfc0650888efcf15e2",
"0xe495aaf1323eb6ea43ca4e4e8acdd0a22eb824c59cb3a360e5b3c4e7e03a6f0f",
"0x8793b6c8640829026df29e3ccca1035014757053faab09cfc5813130666a1808",
"0xfda45c9179ac1b131148eebf862da16296b9ffc7d2204a1cbcd75f121ecc5ce6",
"0x2e8cf7826901b9586bd40cf1bbe988a09e6453fab12543ff822ae847ecbb9fe7",
"0x375727382946ca90e911d992a17b4ab4ea6058185e701391da2de5681b44057b",
"0x3baabf136dfc4cd387878333237276fc632a303719e3203d96ae80e9f5e4b18c",
"0x13dba793793168c1557e66a7ca06e8205c063569a92e32512b4d3e27fd3ee655"
],
"num_leaves": "5450996",
"num_nodes": "10901980"
},
"block_hash": "0x5a5a7de2caf3036851f8faf00a1de064aee98c1ccdbc1566d8cb3987514e8373",
"total_difficulty": "0x924b3a2128",
"txn_accumulator_info": {
"accumulator_root": "0x06d568784241787eab4ffacea24f23c9fccc71b89ff395c1cd8ce2590e45bb5b",
"frozen_subtree_roots": [
"0xfc7c07e2eb59f01a2166dcb3d279836825fd42ab3be6e2cd451b261807ee81b1",
"0x7af7a8632185de88d708bd6a5880eb97a0c57efd05e6f82f55788d359a6f9741",
"0x37d4793e6fbac8f8d2334907c70b07f975d1d97916062c4aee93cecadd15f725",
"0xcaf090772c2a13cd7c01b650d4222924f48ffa38648a9dd468b34b28dfffffce",
"0xae25f8b4c53b72739bc553123fb35cf9fe71ab66a80426e00bdc31ee344cf917",
"0xd43c99bb74892e7c37e89b763970470d8a7f2deb158c321990c29a8165800845",
"0xb3c58543141f4cfc468047defc7898d51b439caec6f7c96b0e5975a2b06cdf7d",
"0x746fea4cdfdd0deac1a327d2c9b9c8750a0d7959ba66916ccdbb624801e43996",
"0x0337d382c64d7010c705a239492b0cf2f6b82ddb9b234574f7f7289a63f1ed01",
"0x8cfe113db8e2784147b36dd478f96fd5a1aeec7677bb36789c500ef1c3ca8f4f",
"0x929d76800089ffa482e37c3787f97cff39631f08bfe70ed94783b240fc2e8f27",
"0x8ce2d1cbd0a184a2ced1b57012cf109aa7527214bde80fb0108e6ca2225e4314",
"0xd27311a2fc2394cbb7f906892b0017ddd0cc599743cd76185637fa11533ef0b1",
"0x98f7cf2c072fa7af76f346b76ea678eec3961425595ec328c9c5762e5d0d820c"
],
"num_leaves": "7510459",
"num_nodes": "15020904"
}
},
"chain_id": 251,
"genesis_hash": "0x6819736ab264bcacc468f64b4e35757f24b18d3a9180cba5c5bac14610c5c968",
"head": {
"author": "0x415b07609ac74e301adf58f9b97db608",
"author_auth_key": null,
"block_accumulator_root": "0x2eb40f7a85839fe6690a32a02042c033cc8d9204a206b8d3937d81000fcfc5ac",
"block_hash": "0x5a5a7de2caf3036851f8faf00a1de064aee98c1ccdbc1566d8cb3987514e8373",
"body_hash": "0xc01e0329de6d899348a8ef4bd51db56175b3fa0988e57c3dcec8eaf13a164d97",
"chain_id": 251,
"difficulty": "0x11d3",
"extra": "0x00000000",
"gas_used": "0",
"nonce": 1320870172,
"number": "5450995",
"parent_hash": "0x27f493df95a893c5651490b0424382fd6bc5a18494e94d5f1eff93beb7c8608c",
"state_root": "0x11874ea10bea0de65d357d3e0a10fbff8ed7246ebd8f9bab7dc475b3e6d5bd9e",
"timestamp": "1655349852171",
"txn_accumulator_root": "0x06d568784241787eab4ffacea24f23c9fccc71b89ff395c1cd8ce2590e45bb5b"
}
},
"notif_protocols": "/starcoin/block/1,/starcoin/txn/1,/starcoin/announcement/1",
"peer_id": "12D3KooWRUQ4CZ6tiy2kZo5vVjm27ksYJAqMwB2QPfqpB5WEfzy4",
"rpc_protocols": "/starcoin/rpc/get_account_state,/starcoin/rpc/get_accumulator_node_by_node_hash,/starcoin/rpc/get_block_ids,/starcoin/rpc/get_block_infos,/starcoin/rpc/get_blocks,/starcoin/rpc/get_bodies_by_hash,/starcoin/rpc/get_headers_by_hash,/starcoin/rpc/get_headers_by_number,/starcoin/rpc/get_state_node_by_node_hash,/starcoin/rpc/get_state_with_proof,/starcoin/rpc/get_txn_infos,/starcoin/rpc/get_txns,/starcoin/rpc/get_txns_from_pool,/starcoin/rpc/get_txns_with_hash_from_pool,/starcoin/rpc/ping",
"version_string": "starcoin/1.11.7-rc (build:1.11.7-rc) (mixed-walk-3687)"
},
{
"chain_info": {
"block_info": {
"block_accumulator_info": {
"accumulator_root": "0x64b8909dfbe80bdfb8cf1368c8515848ff1addde9ebc9b6e11a1f1addd049d95",
"frozen_subtree_roots": [
"0xe74e30d9eba4a2be69417860c5772c8aadba73347a46ff84ad1f80d682a5bb77",
"0x7f83553dccc1aa46a9937e16e0729d01c3f8e0e8a7b5d29f5ad200968321e6d7",
"0x02f628579d5bf98aeb7e2ed2cc4614c830bc343d60b4d1ec8366eb1f77a3a58d",
"0xbec354a925b42571863c70e66bcf2e75c24d7065f9319165d69f884c6da015ee",
"0x0c20e407d5bc49abed71c05f454a4c9b5a242ad89a04d5cfc0650888efcf15e2",
"0xe495aaf1323eb6ea43ca4e4e8acdd0a22eb824c59cb3a360e5b3c4e7e03a6f0f",
"0x8793b6c8640829026df29e3ccca1035014757053faab09cfc5813130666a1808",
"0xfda45c9179ac1b131148eebf862da16296b9ffc7d2204a1cbcd75f121ecc5ce6",
"0x2e8cf7826901b9586bd40cf1bbe988a09e6453fab12543ff822ae847ecbb9fe7",
"0x375727382946ca90e911d992a17b4ab4ea6058185e701391da2de5681b44057b",
"0x3baabf136dfc4cd387878333237276fc632a303719e3203d96ae80e9f5e4b18c",
"0x13dba793793168c1557e66a7ca06e8205c063569a92e32512b4d3e27fd3ee655"
],
"num_leaves": "5450996",
"num_nodes": "10901980"
},
"block_hash": "0x5a5a7de2caf3036851f8faf00a1de064aee98c1ccdbc1566d8cb3987514e8373",
"total_difficulty": "0x924b3a2128",
"txn_accumulator_info": {
"accumulator_root": "0x06d568784241787eab4ffacea24f23c9fccc71b89ff395c1cd8ce2590e45bb5b",
"frozen_subtree_roots": [
"0xfc7c07e2eb59f01a2166dcb3d279836825fd42ab3be6e2cd451b261807ee81b1",
"0x7af7a8632185de88d708bd6a5880eb97a0c57efd05e6f82f55788d359a6f9741",
"0x37d4793e6fbac8f8d2334907c70b07f975d1d97916062c4aee93cecadd15f725",
"0xcaf090772c2a13cd7c01b650d4222924f48ffa38648a9dd468b34b28dfffffce",
"0xae25f8b4c53b72739bc553123fb35cf9fe71ab66a80426e00bdc31ee344cf917",
"0xd43c99bb74892e7c37e89b763970470d8a7f2deb158c321990c29a8165800845",
"0xb3c58543141f4cfc468047defc7898d51b439caec6f7c96b0e5975a2b06cdf7d",
"0x746fea4cdfdd0deac1a327d2c9b9c8750a0d7959ba66916ccdbb624801e43996",
"0x0337d382c64d7010c705a239492b0cf2f6b82ddb9b234574f7f7289a63f1ed01",
"0x8cfe113db8e2784147b36dd478f96fd5a1aeec7677bb36789c500ef1c3ca8f4f",
"0x929d76800089ffa482e37c3787f97cff39631f08bfe70ed94783b240fc2e8f27",
"0x8ce2d1cbd0a184a2ced1b57012cf109aa7527214bde80fb0108e6ca2225e4314",
"0xd27311a2fc2394cbb7f906892b0017ddd0cc599743cd76185637fa11533ef0b1",
"0x98f7cf2c072fa7af76f346b76ea678eec3961425595ec328c9c5762e5d0d820c"
],
"num_leaves": "7510459",
"num_nodes": "15020904"
}
},
"chain_id": 251,
"genesis_hash": "0x6819736ab264bcacc468f64b4e35757f24b18d3a9180cba5c5bac14610c5c968",
"head": {
"author": "0x415b07609ac74e301adf58f9b97db608",
"author_auth_key": null,
"block_accumulator_root": "0x2eb40f7a85839fe6690a32a02042c033cc8d9204a206b8d3937d81000fcfc5ac",
"block_hash": "0x5a5a7de2caf3036851f8faf00a1de064aee98c1ccdbc1566d8cb3987514e8373",
"body_hash": "0xc01e0329de6d899348a8ef4bd51db56175b3fa0988e57c3dcec8eaf13a164d97",
"chain_id": 251,
"difficulty": "0x11d3",
"extra": "0x00000000",
"gas_used": "0",
"nonce": 1320870172,
"number": "5450995",
"parent_hash": "0x27f493df95a893c5651490b0424382fd6bc5a18494e94d5f1eff93beb7c8608c",
"state_root": "0x11874ea10bea0de65d357d3e0a10fbff8ed7246ebd8f9bab7dc475b3e6d5bd9e",
"timestamp": "1655349852171",
"txn_accumulator_root": "0x06d568784241787eab4ffacea24f23c9fccc71b89ff395c1cd8ce2590e45bb5b"
}
},
"notif_protocols": "/starcoin/block/1,/starcoin/txn/1,/starcoin/announcement/1",
"peer_id": "12D3KooWSMJRCgT4inuEZNxvjSCHY1d3DwVX3SQ6qrvqAZCLLMwJ",
"rpc_protocols": "/starcoin/rpc/get_account_state,/starcoin/rpc/get_accumulator_node_by_node_hash,/starcoin/rpc/get_block_ids,/starcoin/rpc/get_block_infos,/starcoin/rpc/get_blocks,/starcoin/rpc/get_bodies_by_hash,/starcoin/rpc/get_headers_by_hash,/starcoin/rpc/get_headers_by_number,/starcoin/rpc/get_state_node_by_node_hash,/starcoin/rpc/get_state_with_proof,/starcoin/rpc/get_txn_infos,/starcoin/rpc/get_txns,/starcoin/rpc/get_txns_from_pool,/starcoin/rpc/get_txns_with_hash_from_pool,/starcoin/rpc/ping",
"version_string": "starcoin/1.11.7-rc (build:1.11.7-rc) (depressed-day-1319)"
}
],
"id": 6153651
} |
Codecov Report
@@ Coverage Diff @@
## master #3471 +/- ##
==========================================
+ Coverage 32.00% 32.23% +0.23%
==========================================
Files 500 500
Lines 46844 46868 +24
Branches 21380 21372 -8
==========================================
+ Hits 14987 15101 +114
- Misses 17588 17589 +1
+ Partials 14269 14178 -91
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
0f154f2
to
d66d51a
Compare
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue Number: #3439
What is the new behavior?
client_version
and set it to a fieldversion_string
ofPeerInfo
while handshaking innetwork-p2p
.version_string
toPeerInfoView
to returnversion_string
innode.peers
RPC invocation.Other information