Skip to content

Commit

Permalink
Merge pull request #517 from iotaledger/fix/mempool-context-input-dou…
Browse files Browse the repository at this point in the history
…ble-spend

Adjust the mempool input setup to correctly handle context inputs.
  • Loading branch information
alexsporn authored Nov 13, 2023
2 parents f3c1f3c + 97ebbca commit cd082d9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/protocol/engine/mempool/v1/state_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,21 @@ func (s *StateMetadata) setupSpender(spender *TransactionMetadata) {
s.increaseSpenderCount()

spender.OnAccepted(func() {
s.spendAccepted.Set(spender)
if !s.state.IsReadOnly() {
s.spendAccepted.Set(spender)
}
})

spender.OnPending(func() {
s.spendAccepted.Set(nil)
if !s.state.IsReadOnly() {
s.spendAccepted.Set(nil)
}
})

spender.OnCommittedSlotUpdated(func(_ iotago.SlotIndex) {
s.spendCommitted.Set(spender)
if !s.state.IsReadOnly() {
s.spendCommitted.Set(spender)
}

s.decreaseSpenderCount()
})
Expand Down

0 comments on commit cd082d9

Please sign in to comment.