/
blockdump.go
39 lines (30 loc) · 929 Bytes
/
blockdump.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: ISC
// Copyright (c) 2014-2020 Bitmark Inc.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package rpccalls
import (
"github.com/bitmark-inc/bitmarkd/rpc/node"
)
// BlockDumpData - the parameters for a blockDump request
type BlockDumpData struct {
Block uint64
Count int
Txs bool
}
// GetBlocks - retrieve some blocks
func (client *Client) GetBlocks(blockDumpConfig *BlockDumpData) (*node.BlockDumpRangeReply, error) {
blockDumpArgs := node.BlockDumpRangeArguments{
Height: blockDumpConfig.Block,
Count: blockDumpConfig.Count,
Txs: blockDumpConfig.Txs,
}
client.printJson("BlockDump Request", blockDumpArgs)
reply := &node.BlockDumpRangeReply{}
err := client.client.Call("Node.BlockDumpRange", blockDumpArgs, reply)
if err != nil {
return nil, err
}
client.printJson("BlockDump Reply", reply)
return reply, nil
}