OSDN Git Service

Merge branch 'master' into bvm
[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.ExtHash)
13 }
14
15 // NewNonce creates a new Nonce.
16 func NewNonce(p *Program) *Nonce {
17         return &Nonce{
18                 Program: p,
19         }
20 }
21
22 func (n *Nonce) SetAnchored(id *Hash) {
23         n.WitnessAnchoredId = id
24 }