Skip to content

update version() #12

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ for examples of usage.
>>> rpc.version()
{
'rpc_version': 1,
'store_version': 10,
'node_vendor': 'RaiBlocks 9.0'
'store_version': 13,
'protocol_version': 16,
'node_vendor': 'Nano 18.0'
}
>>> rpc.peers()
{
Expand Down
5 changes: 3 additions & 2 deletions docs/rpc/methods/node.rst
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ Returns the node's RPC version
>>> rpc.version()
{
"rpc_version": 1,
"store_version": 10,
"node_vendor": "RaiBlocks 9.0"
"store_version": 13,
"protocol_version": 16,
"node_vendor": "Nano 18.0"
}
12 changes: 7 additions & 5 deletions src/nano/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ class Client(object):
>>> rpc.version()
{
'rpc_version': 1,
'store_version': 10,
'node_vendor': 'RaiBlocks 9.0'
'store_version': 13,
'protocol_version': 16,
'node_vendor': 'Nano 18.0'
}
"""

Expand Down Expand Up @@ -3356,15 +3357,16 @@ def version(self):
>>> rpc.version()
{
"rpc_version": 1,
"store_version": 10,
"node_vendor": "RaiBlocks 9.0"
"store_version": 13,
"protocol_version": 16,
"node_vendor": "Nano 18.0"
}

"""

resp = self.call('version')

for key in ('rpc_version', 'store_version'):
for key in ('rpc_version', 'store_version', 'protocol_version'):
resp[key] = int(resp[key])

return resp
Expand Down
10 changes: 6 additions & 4 deletions tests/fixtures/rpc/version.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
[
{
"expected": {
"node_vendor": "RaiBlocks 9.0",
"node_vendor": "Nano 18.0",
"protocol_version": 16,
"rpc_version": 1,
"store_version": 10
"store_version": 13
},
"request": {
"action": "version"
},
"response": {
"node_vendor": "RaiBlocks 9.0",
"node_vendor": "Nano 18.0",
"protocol_version": "16",
"rpc_version": "1",
"store_version": "10"
"store_version": "13"
}
}
]
5 changes: 3 additions & 2 deletions tests/test_mock_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ def test_existing_request(self, mock_rpc_session):
)
assert resp.json() == {
"rpc_version": "1",
"store_version": "10",
"node_vendor": "RaiBlocks 9.0",
"store_version": "13",
"protocol_version": "16",
"node_vendor": "Nano 18.0",
}

def test_missing_request(self, mock_rpc_session):
Expand Down
5 changes: 3 additions & 2 deletions tests/test_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ def test_create(self, arguments):
def test_call_valid_action(self, rpc):
assert rpc.call('version') == {
"rpc_version": "1",
"store_version": "10",
"node_vendor": "RaiBlocks 9.0",
"store_version": "13",
"protocol_version": "16",
"node_vendor": "Nano 18.0",
}

def test_call_invalid_action(self, rpc):
Expand Down