forked from TrueCloudLab/neoneo-go
commit
f48b19a305
2 changed files with 4 additions and 4 deletions
|
@ -117,7 +117,7 @@ Methods:
|
||||||
switch req.Method {
|
switch req.Method {
|
||||||
case "getbestblockhash":
|
case "getbestblockhash":
|
||||||
getbestblockhashCalled.Inc()
|
getbestblockhashCalled.Inc()
|
||||||
results = s.chain.CurrentBlockHash().ReverseString()
|
results = "0x" + s.chain.CurrentBlockHash().ReverseString()
|
||||||
|
|
||||||
case "getblock":
|
case "getblock":
|
||||||
getbestblockCalled.Inc()
|
getbestblockCalled.Inc()
|
||||||
|
@ -157,7 +157,7 @@ Methods:
|
||||||
results = wrappers.NewBlock(block, s.chain)
|
results = wrappers.NewBlock(block, s.chain)
|
||||||
case "getblockcount":
|
case "getblockcount":
|
||||||
getblockcountCalled.Inc()
|
getblockcountCalled.Inc()
|
||||||
results = s.chain.BlockHeight()
|
results = s.chain.BlockHeight() + 1
|
||||||
|
|
||||||
case "getblockhash":
|
case "getblockhash":
|
||||||
getblockHashCalled.Inc()
|
getblockHashCalled.Inc()
|
||||||
|
|
|
@ -28,7 +28,7 @@ func TestRPC(t *testing.T) {
|
||||||
var res StringResultResponse
|
var res StringResultResponse
|
||||||
err := json.Unmarshal(bytes.TrimSpace(body), &res)
|
err := json.Unmarshal(bytes.TrimSpace(body), &res)
|
||||||
assert.NoErrorf(t, err, "could not parse response: %s", body)
|
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) {
|
t.Run("getblock", func(t *testing.T) {
|
||||||
|
@ -51,7 +51,7 @@ func TestRPC(t *testing.T) {
|
||||||
var res IntResultResponse
|
var res IntResultResponse
|
||||||
err := json.Unmarshal(bytes.TrimSpace(body), &res)
|
err := json.Unmarshal(bytes.TrimSpace(body), &res)
|
||||||
assert.NoErrorf(t, err, "could not parse response: %s", body)
|
assert.NoErrorf(t, err, "could not parse response: %s", body)
|
||||||
assert.Equal(t, chain.BlockHeight(), uint32(res.Result))
|
assert.Equal(t, chain.BlockHeight()+1, uint32(res.Result))
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("getblockhash", func(t *testing.T) {
|
t.Run("getblockhash", func(t *testing.T) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue