-
Notifications
You must be signed in to change notification settings - Fork 0
/
server_message.go
42 lines (35 loc) · 1.01 KB
/
server_message.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
package main
// `version` message for checking if current nodes' blockchain is outdated
type version struct {
Version int
BestHeight int // length of blockchain
AddrFrom string // sender's address
}
type address struct {
AddrList []string
}
type block struct {
AddrFrom string // sender's address
Block []byte
}
type tx struct {
AddrFrom string // sender's address
Transaction []byte
}
// `getblocks` message for getting his list of blocks hashes
type getblocks struct {
AddrFrom string // sender's address
}
// `getdata` message for getting data
type getdata struct {
AddrFrom string // sender's address
Type string // two type: "tx" or "block"
ID []byte // transaction/block hash
}
// `inv` message for showing others nodes what blocks or transactions current node has
// for the purpose of broadcast
type inv struct {
AddrFrom string // sender's address
Type string // two type: "tx" or "block"
Items [][]byte // don't contain whole blocks or transactions, just their hashes
}