From e7074099e0bcd10435390c6c67a92f98df3a86ad Mon Sep 17 00:00:00 2001 From: Lazy Nina Date: Mon, 2 Dec 2024 16:14:50 -0500 Subject: [PATCH] limit order txn comes first when selling base for quote --- routes/dao_coin_exchange_with_fees.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/routes/dao_coin_exchange_with_fees.go b/routes/dao_coin_exchange_with_fees.go index 5c1f4f57..c17674e5 100644 --- a/routes/dao_coin_exchange_with_fees.go +++ b/routes/dao_coin_exchange_with_fees.go @@ -1526,6 +1526,9 @@ func (fes *APIServer) HandleMarketOrder( feeBaseUnits, req.MinFeeRateNanosPerKB, nil) + if err != nil { + return nil, fmt.Errorf("HandleMarketOrder: Problem creating transaction: %v", err) + } _, _, _, _, err = utxoView.ConnectTransaction( txn, txn.Hash(), fes.blockchain.BlockTip().Height, fes.blockchain.BlockTip().Header.TstampNanoSecs, @@ -1991,7 +1994,7 @@ func (fes *APIServer) HandleMarketOrder( } // Wrap all of the resulting txns into an atomic - allTxns := append(transferTxns, orderTxn) + allTxns := append([]*lib.MsgDeSoTxn{orderTxn}, transferTxns...) if tokenWhitelistTxn != nil && !skipWhitelist { allTxns = append(allTxns, tokenWhitelistTxn) }