-
Notifications
You must be signed in to change notification settings - Fork 0
/
txheader.go
29 lines (25 loc) · 830 Bytes
/
txheader.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
package bc
import "io"
// TxHeader contains header information for a transaction. Every
// transaction on a blockchain contains exactly one TxHeader. The ID
// of the TxHeader is the ID of the transaction. TxHeader satisfies
// the Entry interface.
func (TxHeader) typ() string { return "txheader" }
func (h *TxHeader) writeForHash(w io.Writer) {
mustWriteForHash(w, h.Version)
mustWriteForHash(w, h.ResultIds)
mustWriteForHash(w, h.Data)
mustWriteForHash(w, h.MinTimeMs)
mustWriteForHash(w, h.MaxTimeMs)
mustWriteForHash(w, h.ExtHash)
}
// NewTxHeader creates an new TxHeader.
func NewTxHeader(version uint64, resultIDs []*Hash, data *Hash, minTimeMS, maxTimeMS uint64) *TxHeader {
return &TxHeader{
Version: version,
ResultIds: resultIDs,
Data: data,
MinTimeMs: minTimeMS,
MaxTimeMs: maxTimeMS,
}
}