forked from TrueCloudLab/neoneo-go
rpc: add ability to answer as C# with block as []byte
This commit is contained in:
parent
7f1844a39e
commit
606616618f
2 changed files with 9 additions and 2 deletions
|
@ -152,7 +152,14 @@ Methods:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(reqParams) == 2 && reqParams[1].Value == 1 {
|
||||||
results = wrappers.NewBlock(block, s.chain)
|
results = wrappers.NewBlock(block, s.chain)
|
||||||
|
} else {
|
||||||
|
writer := io.NewBufBinWriter()
|
||||||
|
block.EncodeBinary(writer.BinWriter)
|
||||||
|
results = hex.EncodeToString(writer.Bytes())
|
||||||
|
}
|
||||||
|
|
||||||
case "getblockcount":
|
case "getblockcount":
|
||||||
getblockcountCalled.Inc()
|
getblockcountCalled.Inc()
|
||||||
results = s.chain.BlockHeight() + 1
|
results = s.chain.BlockHeight() + 1
|
||||||
|
|
|
@ -108,7 +108,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
||||||
"getblock": {
|
"getblock": {
|
||||||
{
|
{
|
||||||
name: "positive",
|
name: "positive",
|
||||||
params: "[1]",
|
params: "[1, 1]",
|
||||||
result: func(e *executor) interface{} { return &GetBlockResponse{} },
|
result: func(e *executor) interface{} { return &GetBlockResponse{} },
|
||||||
check: func(t *testing.T, e *executor, result interface{}) {
|
check: func(t *testing.T, e *executor, result interface{}) {
|
||||||
res, ok := result.(*GetBlockResponse)
|
res, ok := result.(*GetBlockResponse)
|
||||||
|
|
Loading…
Reference in a new issue