mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 18:00:11 +01:00
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
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 New Issue
Block a user