github.com/Bytom/bytom@v1.1.2-0.20210127130405-ae40204c0b09/protocol/bc/txheader.go (about) 1 package bc 2 3 import "io" 4 5 // TxHeader contains header information for a transaction. Every 6 // transaction on a blockchain contains exactly one TxHeader. The ID 7 // of the TxHeader is the ID of the transaction. TxHeader satisfies 8 // the Entry interface. 9 10 func (TxHeader) typ() string { return "txheader" } 11 func (h *TxHeader) writeForHash(w io.Writer) { 12 mustWriteForHash(w, h.Version) 13 mustWriteForHash(w, h.TimeRange) 14 mustWriteForHash(w, h.ResultIds) 15 } 16 17 // NewTxHeader creates an new TxHeader. 18 func NewTxHeader(version, serializedSize, timeRange uint64, resultIDs []*Hash) *TxHeader { 19 return &TxHeader{ 20 Version: version, 21 SerializedSize: serializedSize, 22 TimeRange: timeRange, 23 ResultIds: resultIDs, 24 } 25 }