Skip to content

Commit

Permalink
Merge pull request #540 from tonkeeper/sort_txs_in_block
Browse files Browse the repository at this point in the history
order txs by lt
  • Loading branch information
mr-tron authored Nov 18, 2024
2 parents 046cb95 + 145beb7 commit c3c95cf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/api/blockchain_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"net/http"
"sort"

"golang.org/x/exp/maps"

Expand Down Expand Up @@ -195,6 +196,9 @@ func (h *Handler) GetBlockchainMasterchainTransactions(ctx context.Context, para
result.Transactions = append(result.Transactions, convertTransaction(*tx, nil, h.addressBook))
}
}
sort.Slice(result.Transactions, func(i, j int) bool {
return result.Transactions[i].Lt < result.Transactions[j].Lt
})
return &result, nil
}

Expand All @@ -216,6 +220,9 @@ func (h *Handler) GetBlockchainBlockTransactions(ctx context.Context, params oas
for _, tx := range transactions {
res.Transactions = append(res.Transactions, convertTransaction(*tx, nil, h.addressBook))
}
sort.Slice(res.Transactions, func(i, j int) bool {
return res.Transactions[i].Lt < res.Transactions[j].Lt
})
return &res, nil
}

Expand Down

0 comments on commit c3c95cf

Please sign in to comment.