mirror of
https://github.com/kaspanet/kaspad.git
synced 2026-03-17 21:58:48 +00:00
Make use of removeChildNode function.
Rather than duplicating this code in the removeBlockNode function, use the existing function.
This commit is contained in:
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.
|
||||
|
||||
Reference in New Issue
Block a user