Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion hashednode.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
"fmt"
)

var ErrReadFromHashedNode = errors.New("can not read from a hash node")

type HashedNode struct {
commitment []byte
cachedPoint *Point
Expand All @@ -48,7 +50,7 @@ func (*HashedNode) Delete([]byte, NodeResolverFn) error {
}

func (*HashedNode) Get([]byte, NodeResolverFn) ([]byte, error) {
return nil, errors.New("can not read from a hash node")
return nil, ErrReadFromHashedNode
}

func (n *HashedNode) Commit() *Point {
Expand Down
3 changes: 3 additions & 0 deletions stateless.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ func (n *StatelessNode) insertStem(path []byte, stemInfo stemInfo, comms []*Poin
// nothing to do
case extStatusAbsentOther:
// insert poa stem
serialized := comms[0].Bytes()
n.children[path[0]] = &HashedNode{commitment: serialized[:], cachedPoint: comms[0]}
comms = comms[1:]
case extStatusPresent:
// insert stem
newchild := NewStatelessWithCommitment(comms[0])
Expand Down