forked from FactomProject/factom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eblock.go
41 lines (36 loc) · 1.12 KB
/
eblock.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
// Copyright 2016 Factom Foundation
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
package factom
import (
"fmt"
)
type EBlock struct {
Header struct {
BlockSequenceNumber int64 `json:"blocksequencenumber"`
ChainID string `json:"chainid"`
PrevKeyMR string `json:"prevkeymr"`
Timestamp int64 `json:"timestamp"`
DBHeight int64 `json:"dbheight"`
} `json:"header"`
EntryList []EBEntry `json:"entrylist"`
}
type EBEntry struct {
EntryHash string `json:"entryhash"`
Timestamp int64 `json:"timestamp"`
}
func (e *EBlock) String() string {
var s string
s += fmt.Sprintln("BlockSequenceNumber:", e.Header.BlockSequenceNumber)
s += fmt.Sprintln("ChainID:", e.Header.ChainID)
s += fmt.Sprintln("PrevKeyMR:", e.Header.PrevKeyMR)
s += fmt.Sprintln("Timestamp:", e.Header.Timestamp)
s += fmt.Sprintln("DBHeight:", e.Header.DBHeight)
for _, v := range e.EntryList {
s += fmt.Sprintln("EBEntry {")
s += fmt.Sprintln(" Timestamp", v.Timestamp)
s += fmt.Sprintln(" EntryHash", v.EntryHash)
s += fmt.Sprintln("}")
}
return s
}