From 0c2d4435ca65a455808b6b75cd6dfd1c023beb45 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 1 Aug 2013 22:28:25 -0500 Subject: [PATCH] Make use of removeChildNode function. Rather than duplicating this code in the removeBlockNode function, use the existing function. --- chain.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/chain.go b/chain.go index e6bd5d8e..04617efb 100644 --- a/chain.go +++ b/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.