ledger: fix prior depth checks for collapseTransactions
@@ -571,7 +571,9 @@ func (l *Ledger) collapseTransactions(round uint64, tx *Transaction, logging boo
visited[parentID] = struct{}{}
if parent, exists := l.graph.lookupTransactionByID(parentID); exists {
+ if parent.Depth > root.Depth {
aq.PushBack(parent)
+ }
} else {
return snapshot, errors.Errorf("missing parent %x to correctly collapse down ledger state from critical transaction %x", parentID, tx.ID)
}
@@ -587,8 +589,10 @@ func (l *Ledger) collapseTransactions(round uint64, tx *Transaction, logging boo
if _, seen := visited[parentID]; !seen {
visited[parentID] = struct{}{}
- if parent, exists := l.graph.lookupTransactionByID(parentID); exists && parent.Depth > root.Depth {
+ if parent, exists := l.graph.lookupTransactionByID(parentID); exists {
+ if parent.Depth > root.Depth {
aq.PushBack(parent)
+ }
} else {
return snapshot, errors.Errorf("missing ancestor %x to correctly collapse down ledger state from critical transaction %x", parentID, tx.ID)
}
