From b28e5ce816c8f9ea69720b0c8d2e8fb63fc1d6c3 Mon Sep 17 00:00:00 2001 From: tal Date: Mon, 30 Nov 2020 15:48:08 +0200 Subject: [PATCH] [#1126] Place selectedParent to be first on blueMergeSet. --- domain/consensus/processes/ghostdag2/ghostdagimpl.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/domain/consensus/processes/ghostdag2/ghostdagimpl.go b/domain/consensus/processes/ghostdag2/ghostdagimpl.go index 819417406..34b3008e2 100644 --- a/domain/consensus/processes/ghostdag2/ghostdagimpl.go +++ b/domain/consensus/processes/ghostdag2/ghostdagimpl.go @@ -59,6 +59,8 @@ func (gh *ghostdagHelper) GHOSTDAG(blockCandidate *externalapi.DomainHash) error var mergeSetReds = make([]*externalapi.DomainHash, 0) var blueSet = make([]*externalapi.DomainHash, 0) + mergeSetBlues = append(mergeSetBlues, selectedParent) + mergeSetArr, err := gh.findMergeSet(blockParents, selectedParent) if err != nil { return err @@ -352,8 +354,8 @@ func (gh *ghostdagHelper) sortByBlueScore(arr []*externalapi.DomainHash) error { err = error return false } - var isSmaller bool = false - if blockRight.BlueScore < blockLeft.BlueScore { + var isSmaller = false + if blockLeft.BlueScore < blockRight.BlueScore { isSmaller = true } else { if blockRight.BlueScore == blockLeft.BlueScore {