Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
JsonRpcApi: getrawmempool fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
metachris committed Jan 23, 2018
1 parent d202472 commit a02a61d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion neo/api/JSONRPC/JsonRpcApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def json_rpc_method_handler(self, method, params):
# return contract.ToJson()

elif method == "getrawmempool":
return list(map(lambda hash: hash.decode('utf-8'), NodeLeader.Instance().MemPool.keys()))
return list(map(lambda hash: "0x%s" % hash.decode('utf-8'), NodeLeader.Instance().MemPool.keys()))

elif method == "getversion":
return {
Expand Down
9 changes: 8 additions & 1 deletion neo/api/JSONRPC/test_json_rpc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,14 @@ def test_get_raw_mempool(self):
req = self._gen_rpc_req("getrawmempool", params=[])
mock_req = mock_request(json.dumps(req).encode("utf-8"))
res = json.loads(self.app.home(mock_req))
self.assertEqual(res['result'], [])
mempool = res['result']

# when running only these tests, mempool is empty. when running all tests, there are a
# number of entries
if len(mempool) > 0:
for entry in mempool:
self.assertEqual(entry[0:2], "0x")
self.assertEqual(len(entry), 66)

def test_get_version(self):
# TODO: what's the nonce? on testnet live server response it's always 771199013
Expand Down

0 comments on commit a02a61d

Please sign in to comment.