Make use of removeChildNode function.
Rather than duplicating this code in the removeBlockNode function, use the existing function.
This commit is contained in:
parent
1a5683e220
commit
0c2d4435ca
1 changed files with 1 additions and 7 deletions
8
chain.go
8
chain.go
|
@ -445,13 +445,7 @@ func (b *BlockChain) removeBlockNode(node *blockNode) error {
|
|||
if children, ok := b.depNodes[*prevHash]; ok {
|
||||
// Find the node amongst the children of the
|
||||
// dependencies for the parent hash and remove it.
|
||||
for i, child := range children {
|
||||
if child == node {
|
||||
copy(children[i:], children[i+1:])
|
||||
children[len(children)-1] = nil
|
||||
b.depNodes[*prevHash] = children[:len(children)-1]
|
||||
}
|
||||
}
|
||||
b.depNodes[*prevHash] = removeChildNode(children, node)
|
||||
|
||||
// Remove the map entry altogether if there are no
|
||||
// longer any nodes which depend on the parent hash.
|
||||
|
|
Loading…
Reference in a new issue