Skip to content

Commit

Permalink
UI: Fix pending trade rows get bad updates from UpdateData()
Browse files Browse the repository at this point in the history
  • Loading branch information
zathras-crypto committed May 20, 2015
1 parent c171e02 commit 808b3b1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/qt/tradehistorydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ void TradeHistoryDialog::UpdateTradeHistoryTable()
amountOutCell->setForeground(QColor("#993333"));
amountInCell->setForeground(QColor("#006600"));
}
if(objTH.amountIn.substr(0,2) == "0 ") amountInCell->setForeground(QColor("#000000"));
if(objTH.amountOut.substr(0,2) == "0 ") amountOutCell->setForeground(QColor("#000000"));
if(objTH.amountIn.substr(0,2) == "0 " || objTH.amountIn == "---" ) amountInCell->setForeground(QColor("#000000"));
if(objTH.amountOut.substr(0,2) == "0 " || objTH.amountOut == "---" ) amountOutCell->setForeground(QColor("#000000"));

// Set the cells in the new row accordingly
ui->tradeHistoryTable->setItem(newRow, 0, txidCell);
Expand Down Expand Up @@ -411,7 +411,8 @@ void TradeHistoryDialog::UpdateData()
}
TradeHistoryObject *tmpObjTH = &(hIter->second);
if (tmpObjTH->status == "Filled" || tmpObjTH->status == "Cancelled") continue; // once a trade hits this status the details should never change
if (tmpObjTH->blockHeight > 0 && lastUpdateBlock == chainHeight) continue; // no new blocks since last update, don't waste compute looking for updates
if (tmpObjTH->blockHeight == 0) continue; // do not attempt to refresh details for a trade that's still pending
if (lastUpdateBlock == chainHeight) continue; // no new blocks since last update, don't waste compute looking for updates

// at this point we have an active trade and there have been new block(s) since the last update - refresh status and amounts
uint32_t propertyIdForSale = tmpObjTH->propertyIdForSale;
Expand Down

0 comments on commit 808b3b1

Please sign in to comment.