File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,8 +187,11 @@ func (bt *BlockTree) Prune(finalised Hash) (pruned []Hash) {
187187
188188 pruned = bt .head .prune (n , nil )
189189 bt .head = n
190+ leaves := n .getLeaves (nil )
190191 bt .leaves = newEmptyLeafMap ()
191- bt .leaves .store (n .hash , n )
192+ for _ , leaf := range leaves {
193+ bt .leaves .store (leaf .hash , leaf )
194+ }
192195 return pruned
193196}
194197
Original file line number Diff line number Diff line change @@ -378,6 +378,12 @@ func TestBlockTree_Prune(t *testing.T) {
378378 t .Fatal ("pruned an ancestor of the finalised node!!" )
379379 }
380380 }
381+
382+ require .NotEqual (t , 0 , len (bt .leaves .nodes ()))
383+ for _ , leaf := range bt .leaves .nodes () {
384+ require .NotEqual (t , leaf .hash , finalised .hash )
385+ require .True (t , leaf .isDescendantOf (finalised ))
386+ }
381387}
382388
383389func TestBlockTree_DeepCopy (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments