rpc: add 0x prefix to the getbestblockhash answer

For consistency with C# nodes that do add it to their answers.
This commit is contained in:
Roman Khimov 2019-11-01 16:36:32 +03:00
parent 54bb9b94c7
commit 70e4529848
2 changed files with 2 additions and 2 deletions

View file

@ -117,7 +117,7 @@ Methods:
switch req.Method {
case "getbestblockhash":
getbestblockhashCalled.Inc()
results = s.chain.CurrentBlockHash().ReverseString()
results = "0x" + s.chain.CurrentBlockHash().ReverseString()
case "getblock":
getbestblockCalled.Inc()

View file

@ -28,7 +28,7 @@ func TestRPC(t *testing.T) {
var res StringResultResponse
err := json.Unmarshal(bytes.TrimSpace(body), &res)
assert.NoErrorf(t, err, "could not parse response: %s", body)
assert.Equal(t, chain.CurrentBlockHash().ReverseString(), res.Result)
assert.Equal(t, "0x"+chain.CurrentBlockHash().ReverseString(), res.Result)
})
t.Run("getblock", func(t *testing.T) {