forked from aergoio/aergo
/
blockchainmsg.go
186 lines (161 loc) · 2.86 KB
/
blockchainmsg.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/**
* @file
* @copyright defined in aergo/LICENSE.txt
*/
package message
import (
"github.com/aergoio/aergo/types"
"github.com/libp2p/go-libp2p-peer"
)
const ChainSvc = "ChainSvc"
type GetBestBlockNo struct{}
type GetBestBlockNoRsp struct {
BlockNo types.BlockNo
}
type GetBestBlock struct{}
type GetBestBlockRsp GetBlockRsp
type GetBlock struct {
BlockHash []byte
}
type GetBlockRsp struct {
Block *types.Block
Err error
}
type GetBlockByNo struct {
BlockNo types.BlockNo
}
type GetBlockByNoRsp GetBlockRsp
type AddBlock struct {
PeerID peer.ID
Block *types.Block
Bstate interface{}
IsSync bool
// Bstate *types.BlockState
}
type AddBlockRsp struct {
BlockNo types.BlockNo
BlockHash []byte
Err error
}
type GetState struct {
Account []byte
}
type GetStateRsp struct {
Account []byte
State *types.State
Err error
}
type GetStateAndProof struct {
Account []byte
Root []byte
Compressed bool
}
type GetStateAndProofRsp struct {
StateProof *types.AccountProof
Err error
}
type GetTx struct {
TxHash []byte
}
type GetTxRsp struct {
Tx *types.Tx
TxIds *types.TxIdx
Err error
}
type GetReceipt struct {
TxHash []byte
}
type GetReceiptRsp struct {
Receipt *types.Receipt
Err error
}
type GetABI struct {
Contract []byte
}
type GetABIRsp struct {
ABI *types.ABI
Err error
}
type GetQuery struct {
Contract []byte
Queryinfo []byte
}
type GetQueryRsp struct {
Result []byte
Err error
}
type GetStateQuery struct {
ContractAddress []byte
StorageKeys []string
Root []byte
Compressed bool
}
type GetStateQueryRsp struct {
Result *types.StateQueryProof
Err error
}
// SyncBlockState is request to sync from remote peer. It returns sync result.
type SyncBlockState struct {
PeerID peer.ID
BlockNo types.BlockNo
BlockHash []byte
}
// GetElected is request to get voting result about top N elect
type GetElected struct {
Id string
N uint32
}
type GetVote struct {
Addr []byte
Ids []string
}
// GetElectedRsp is return to get voting result
type GetVoteRsp struct {
Top *types.VoteList
Err error
}
type GetAccountVoteRsp struct {
Info *types.AccountVoteInfo
Err error
}
type GetStaking struct {
Addr []byte
}
type GetStakingRsp struct {
Staking *types.Staking
Err error
}
type GetNameInfo struct {
Name string
}
type GetNameInfoRsp struct {
Owner *types.NameInfo
Err error
}
type GetAnchors struct {
Seq uint64
}
type GetAnchorsRsp struct {
Seq uint64
Hashes [][]byte
LastNo types.BlockNo
Err error
}
// receive from p2p
type GetAncestor struct {
Hashes [][]byte
StopHash []byte
}
// response to p2p for GetAncestor message
type GetAncestorRsp struct {
Ancestor *types.BlockInfo
Err error
}
type ListEvents struct {
Filter *types.FilterInfo
}
// response to p2p for GetAncestor message
type ListEventsRsp struct {
Events []*types.Event
Err error
}