Skip to content

Commit

Permalink
Fix removing matched intentions
Browse files Browse the repository at this point in the history
  • Loading branch information
erokhinav committed Sep 25, 2024
1 parent 69e53dc commit 6f0b367
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/bath/intentions.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func extractIntentions(trace *core.Trace) ([]OutMessage, int) {

func removeMatchedIntentions(trace *core.Trace, intentions *[]OutMessage) []OutMessage {
var matchAndRemove func(*core.Trace)
removed := 0
matchAndRemove = func(trace *core.Trace) {
if trace == nil {
return
Expand All @@ -71,7 +72,8 @@ func removeMatchedIntentions(trace *core.Trace, intentions *[]OutMessage) []OutM
for i, outMsg := range *intentions {
if isMatch(outMsg, child.Transaction.InMsg) {
// remove this outgoing message
*intentions = append((*intentions)[:i], (*intentions)[i+1:]...)
*intentions = append((*intentions)[:i-removed], (*intentions)[i+1-removed:]...)
removed++
}
}
matchAndRemove(child)
Expand Down

0 comments on commit 6f0b367

Please sign in to comment.