Skip to content

Commit

Permalink
Call unhook for all evicted elements in SpendDAG.
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrm50 committed Apr 18, 2024
1 parent e2eb24c commit ab053d6
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkg/protocol/engine/mempool/spenddag/spenddagv1/spenddag.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,12 @@ func (c *SpendDAG[SpenderID, ResourceID, VoteRank]) evictSpender(spenderID Spend
// remove the spenders from the spenddag dictionary
for _, evictedSpenderID := range evictedSpenderIDs {
c.spendersByID.Delete(evictedSpenderID)
}

// unhook the spend events and remove the unhook method from the storage
unhookFunc, unhookExists := c.spendUnhooks.Get(spenderID)
if unhookExists {
unhookFunc()
c.spendUnhooks.Delete(spenderID)
// unhook the spend events and remove the unhook method from the storage
unhookFunc, unhookExists := c.spendUnhooks.Get(spenderID)
if unhookExists {
unhookFunc()
c.spendUnhooks.Delete(spenderID)
}
}

return evictedSpenderIDs
Expand Down

0 comments on commit ab053d6

Please sign in to comment.