Skip to content

Commit

Permalink
bug fix searching output index
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-cha committed Aug 12, 2024
1 parent 1483c2a commit d676dad
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions executor/host/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ func (h Host) QueryOutputByL2BlockNumber(bridgeId uint64, l2BlockNumber uint64)

for {
if start.OutputProposal.L2BlockNumber >= l2BlockNumber {
if start.OutputIndex != 1 {
return h.QueryOutput(bridgeId, start.OutputIndex-1)
}
return nil, nil
} else if end.OutputProposal.L2BlockNumber < l2BlockNumber {
return end, nil
Expand All @@ -84,9 +87,7 @@ func (h Host) QueryOutputByL2BlockNumber(bridgeId uint64, l2BlockNumber uint64)
return nil, err
}

if output.OutputProposal.L2BlockNumber == l2BlockNumber {
return output, nil
} else if output.OutputProposal.L2BlockNumber < l2BlockNumber {
if output.OutputProposal.L2BlockNumber <= l2BlockNumber {
start = output
} else {
end = output
Expand Down

0 comments on commit d676dad

Please sign in to comment.