-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrpc.go
77 lines (63 loc) · 2.42 KB
/
rpc.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package moneroproto
import "github.com/exantech/moneroutil"
type GetHashesFastRequest struct {
Client []byte `monerobinkv:"client"`
BlockIds []byte `monerobinkv:"block_ids"`
StartHeight uint64 `monerobinkv:"start_height"`
}
func (g *GetHashesFastRequest) SetHashes(hashes []moneroutil.Hash) {
g.BlockIds = HashesToByteSlice(hashes)
}
func (g *GetHashesFastRequest) GetHashes() (error, []moneroutil.Hash) {
return ByteSliceToHashes(g.BlockIds)
}
type GetHashesFastResponse struct {
BlockIds []byte `monerobinkv:"m_block_ids"`
StartHeight uint64 `monerobinkv:"start_height"`
CurrentHeight uint64 `monerobinkv:"current_height"`
Status []byte `monerobinkv:"status"`
Untrusted bool `monerobinkv:"untrusted"`
Credits uint64 `monerobinkv:"credits"`
TopHash []byte `monerobinkv:"top_hash"`
}
func (g *GetHashesFastResponse) SetHashes(hashes []moneroutil.Hash) {
g.BlockIds = HashesToByteSlice(hashes)
}
func (g *GetHashesFastResponse) GetHashes() (error, []moneroutil.Hash) {
return ByteSliceToHashes(g.BlockIds)
}
type GetBlocksFastRequest struct {
Client []byte `monerobinkv:"client"`
BlockIds []byte `monerobinkv:"block_ids"`
StartHeight uint64 `monerobinkv:"start_height"`
Prune bool `monerobinkv:"prune"`
NoMinerTx bool `monerobinkv:"no_miner_tx"`
}
func (g *GetBlocksFastRequest) SetHashes(hashes []moneroutil.Hash) {
g.BlockIds = HashesToByteSlice(hashes)
}
func (g *GetBlocksFastRequest) GetHashes() (error, []moneroutil.Hash) {
return ByteSliceToHashes(g.BlockIds)
}
type BlockCompleteEntry struct {
Pruned bool `monerobinkv:"pruned"`
Block []byte `monerobinkv:"block"`
BlockWeight uint64 `monerobinkv:"block_weight"`
Txs [][]byte `monerobinkv:"txs"`
}
type TxOutputIndices struct {
Indices []uint64 `monerobinkv:"indices"`
}
type BlockOutputIndices struct {
Indices []TxOutputIndices `monerobinkv:"indices"`
}
type GetBlocksFastResponse struct {
Blocks []BlockCompleteEntry `monerobinkv:"blocks"`
StartHeight uint64 `monerobinkv:"start_height"`
CurrentHeight uint64 `monerobinkv:"current_height"`
Status []byte `monerobinkv:"status"`
OutputIndices []BlockOutputIndices `monerobinkv:"output_indices"`
Untrusted bool `monerobinkv:"untrusted"`
Credits uint64 `monerobinkv:"credits"`
TopHash []byte `monerobinkv:"top_hash"`
}