mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 19:42:23 +00:00
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
|
||||
}
|
||||
|
||||
results = wrappers.NewBlock(block, s.chain)
|
||||
if len(reqParams) == 2 && reqParams[1].Value == 1 {
|
||||
results = wrappers.NewBlock(block, s.chain)
|
||||
} else {
|
||||
writer := io.NewBufBinWriter()
|
||||
block.EncodeBinary(writer.BinWriter)
|
||||
results = hex.EncodeToString(writer.Bytes())
|
||||
}
|
||||
|
||||
case "getblockcount":
|
||||
getblockcountCalled.Inc()
|
||||
results = s.chain.BlockHeight() + 1
|
||||
|
|
|
@ -108,7 +108,7 @@ var rpcTestCases = map[string][]rpcTestCase{
|
|||
"getblock": {
|
||||
{
|
||||
name: "positive",
|
||||
params: "[1]",
|
||||
params: "[1, 1]",
|
||||
result: func(e *executor) interface{} { return &GetBlockResponse{} },
|
||||
check: func(t *testing.T, e *executor, result interface{}) {
|
||||
res, ok := result.(*GetBlockResponse)
|
||||
|
|
Loading…
Reference in a new issue