OSDN Git Service

Added blockchain struct.
[bytom/bytom.git] / protocol / bc / nonce.go
1 package bc
2
3 import "io"
4
5 // Nonce contains data used, among other things, for distinguishing
6 // otherwise-identical issuances (when used as those issuances'
7 // "anchors"). It satisfies the Entry interface.
8
9 func (Nonce) typ() string { return "nonce1" }
10 func (n *Nonce) writeForHash(w io.Writer) {
11         mustWriteForHash(w, n.Program)
12         mustWriteForHash(w, n.TimeRangeId)
13         mustWriteForHash(w, n.ExtHash)
14 }
15
16 // NewNonce creates a new Nonce.
17 func NewNonce(p *Program, trID *Hash) *Nonce {
18         return &Nonce{
19                 Program:     p,
20                 TimeRangeId: trID,
21         }
22 }
23
24 func (n *Nonce) SetAnchored(id *Hash) {
25         n.WitnessAnchoredId = id
26 }