Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ElkremNode ¶
type ElkremNode struct { H uint8 `json:"h"` // height of this node I uint64 `json:"i"` // index (i'th node) Sha *chainhash.Hash `json:"hash"` // hash }
You can calculate h from i but I can't figure out how without taking O(i) ops. Feels like there should be a clever O(h) way. 1 byte, whatever.
type ElkremReceiver ¶
type ElkremReceiver struct {
Nodes []ElkremNode `json:"nodes"` // store of received hashes
}
func ElkremReceiverFromBytes ¶
func ElkremReceiverFromBytes(b []byte) (*ElkremReceiver, error)
func NewElkremReceiver ¶
func NewElkremReceiver() *ElkremReceiver
NewElkremReceiver makes a new empty elkrem receiver.
func (*ElkremReceiver) AddNext ¶
func (e *ElkremReceiver) AddNext(sha *chainhash.Hash) error
AddNext inserts the next hash in the tree. Returns an error if the incoming hash doesn't fit.
func (*ElkremReceiver) AtIndex ¶
func (e *ElkremReceiver) AtIndex(w uint64) (*chainhash.Hash, error)
AtIndex returns the w'th hash in the receiver.
func (*ElkremReceiver) ToBytes ¶
func (e *ElkremReceiver) ToBytes() ([]byte, error)
ToBytes turns the Elkrem Receiver into a bunch of bytes in a slice. first the number of nodes (1 byte), then a series of 41 byte long serialized nodes, which are 1 byte height, 8 byte index, 32 byte hash.
func (*ElkremReceiver) UpTo ¶
func (e *ElkremReceiver) UpTo() uint64
UpTo tells you what the receiver can go up to.
type ElkremSender ¶
type ElkremSender struct {
// contains filtered or unexported fields
}
func NewElkremSender ¶
func NewElkremSender(r chainhash.Hash) *ElkremSender
NewElkremSender makes a new elkrem sender from a root hash.