(data ElementData, index uint32)
| 49 | } |
| 50 | |
| 51 | func (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 | |
| 68 | func (mt *MerkleTree) insertNode(_node node) { |
| 69 | var e, prev *list.Element |
no test coverage detected