Skip to content

Commit 61b85cb

Browse files
author
lazyluis
committed
fix tx order issue
1 parent 9284484 commit 61b85cb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

x/oracle/extenstion.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ type StakeWeightedPrices struct {
144144
func (h *ProposalHandler) PrepareProposal() sdk.PrepareProposalHandler {
145145
return func(ctx sdk.Context, req *abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error) {
146146

147-
h.logger.Info("PrepareProposal", "height", req.Height)
148-
// ctx.ConsensusParams().Abci.VoteExtensionsEnableHeight = 1
149-
150147
proposalTxs := req.Txs
151148

152149
if req.Height >= ctx.ConsensusParams().Abci.VoteExtensionsEnableHeight && ctx.ConsensusParams().Abci.VoteExtensionsEnableHeight != 0 {
@@ -176,7 +173,7 @@ func (h *ProposalHandler) PrepareProposal() sdk.PrepareProposalHandler {
176173

177174
// Inject a "fake" tx into the proposal s.t. validators can decode, verify,
178175
// and store the canonical stake-weighted average prices.
179-
proposalTxs = append(proposalTxs, bz)
176+
proposalTxs = append([][]byte{bz}, proposalTxs...)
180177
}
181178

182179
// proceed with normal block proposal construction, e.g. POB, normal txs, etc...

x/oracle/types/keys.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ func CleanPrices(expire int64) {
7171

7272
func setMapValue(target map[string][]Price, ex string, p Price) {
7373
if list, ok := target[ex]; ok {
74+
if len(list) > 500 {
75+
list = list[500:]
76+
}
7477
list = append(list, p)
7578
target[ex] = list
7679
} else {

0 commit comments

Comments
 (0)