mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-10-14 00:59:33 +00:00
Fix a potential issue with removing orphan blocks.
The range loop is over a local var, so the local variable needs to be updated and then set back into the chain instance after the range loop.
This commit is contained in:
parent
0c2d4435ca
commit
c00de3ffd5
3
chain.go
3
chain.go
@ -194,9 +194,10 @@ func (b *BlockChain) removeOrphanBlock(orphan *orphanBlock) {
|
|||||||
if hash.IsEqual(orphanHash) {
|
if hash.IsEqual(orphanHash) {
|
||||||
copy(orphans[i:], orphans[i+1:])
|
copy(orphans[i:], orphans[i+1:])
|
||||||
orphans[len(orphans)-1] = nil
|
orphans[len(orphans)-1] = nil
|
||||||
b.prevOrphans[*prevHash] = orphans[:len(orphans)-1]
|
orphans = orphans[:len(orphans)-1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
b.prevOrphans[*prevHash] = orphans
|
||||||
|
|
||||||
// Remove the map entry altogether if there are no longer any orphans
|
// Remove the map entry altogether if there are no longer any orphans
|
||||||
// which depend on the parent hash.
|
// which depend on the parent hash.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user