mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
[NOD-1535] Add new block to virtual diff parents only if it's valid (#1077)
This commit is contained in:
parent
fddce00d08
commit
a0c6076ccc
@ -66,7 +66,16 @@ func (csm *consensusStateManager) updateVirtualDiffParents(
|
||||
}
|
||||
newBlockParents := hashset.NewFromSlice(newBlockParentsSlice...)
|
||||
|
||||
newVirtualDiffParents := []*externalapi.DomainHash{newBlockHash}
|
||||
newVirtualDiffParents := []*externalapi.DomainHash{}
|
||||
status, err := csm.blockStatusStore.Get(csm.databaseContext, newBlockHash)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if status == externalapi.StatusValid {
|
||||
newVirtualDiffParents = append(newVirtualDiffParents, newBlockHash)
|
||||
}
|
||||
|
||||
for _, virtualDiffParent := range virtualDiffParents {
|
||||
if !newBlockParents.Contains(virtualDiffParent) {
|
||||
newVirtualDiffParents = append(newVirtualDiffParents, virtualDiffParent)
|
||||
|
Loading…
x
Reference in New Issue
Block a user