MCPcopy Create free account
hub / github.com/SmartPool/smartpool-client / Insert

Method Insert

mtree/merkle_tree.go:51–66  ·  view source on GitHub ↗
(data ElementData, index uint32)

Source from the content-addressed store, hash-verified

49}
50
51func (mt *MerkleTree) Insert(data ElementData, index uint32) {
52 _node := node{mt.eh(data), 1, &map[uint32]BranchTree{}}
53 // fmt.Printf("Inserted node for word (%s): %4s\n", hex.EncodeToString(data[:]), hex.EncodeToString(_node.Data[:]))
54 if mt.indexes[index] {
55 (*_node.Branches)[index] = BranchTree{
56 RawData: data,
57 HashedData: _node.Data,
58 Root: &BranchNode{
59 Hash: _node.Data,
60 Left: nil,
61 Right: nil,
62 },
63 }
64 }
65 mt.insertNode(_node)
66}
67
68func (mt *MerkleTree) insertNode(_node node) {
69 var e, prev *list.Element

Callers 3

buildProofAugTreeMethod · 0.80
buildAugTreeMethod · 0.80
processDuringReadFunction · 0.80

Calls 1

insertNodeMethod · 0.95

Tested by

no test coverage detected