OSDN Git Service

delete some black utxo (#2129)
[bytom/bytom.git] / protocol / bc / blockheader.go
1 package bc
2
3 import "io"
4
5 // BlockHeader contains the header information for a blockchain
6 // block. It satisfies the Entry interface.
7 func (BlockHeader) typ() string { return "blockheader" }
8 func (bh *BlockHeader) writeForHash(w io.Writer) {
9         mustWriteForHash(w, bh.Version)
10         mustWriteForHash(w, bh.Height)
11         mustWriteForHash(w, bh.PreviousBlockId)
12         mustWriteForHash(w, bh.Timestamp)
13         mustWriteForHash(w, bh.TransactionsRoot)
14 }
15
16 // NewBlockHeader creates a new BlockHeader and populates
17 // its body.
18 func NewBlockHeader(version, height uint64, previousBlockID *Hash, timestamp uint64, transactionsRoot *Hash) *BlockHeader {
19         return &BlockHeader{
20                 Version:          version,
21                 Height:           height,
22                 PreviousBlockId:  previousBlockID,
23                 Timestamp:        timestamp,
24                 TransactionsRoot: transactionsRoot,
25         }
26 }