Add pending ops
This commit is contained in:
@@ -46,6 +46,7 @@ public:
|
||||
void sendZTransaction (json params, const std::function<void(json)>& cb);
|
||||
void watchTxStatus();
|
||||
void addNewTxToWatch(Tx tx, const QString& newOpid);
|
||||
const QMap<QString, Tx> getWatchingTxns() { return watchingOps; }
|
||||
|
||||
const TxTableModel* getTransactionsModel() { return transactionsTableModel; }
|
||||
const QList<QString>* getAllZAddresses() { return zaddresses; }
|
||||
|
||||
@@ -185,6 +185,22 @@ QJsonDocument AppDataServer::processGetInfo(MainWindow* mainWindow) {
|
||||
QJsonDocument AppDataServer::processGetTransactions(MainWindow* mainWindow) {
|
||||
QJsonArray txns;
|
||||
auto model = mainWindow->getRPC()->getTransactionsModel();
|
||||
|
||||
// Manually add pending ops, so that computing transactions will also show up
|
||||
auto wtxns = mainWindow->getRPC()->getWatchingTxns();
|
||||
for (auto opid : wtxns.keys()) {
|
||||
txns.append(QJsonObject{
|
||||
{"type", "send"},
|
||||
{"datetime", QDateTime::currentSecsSinceEpoch()},
|
||||
{"amount", wtxns[opid].toAddrs[0].amount},
|
||||
{"txid", ""},
|
||||
{"address", wtxns[opid].toAddrs[0].addr},
|
||||
{"memo", wtxns[opid].toAddrs[0].txtMemo},
|
||||
{"confirmations", 0}
|
||||
});
|
||||
}
|
||||
|
||||
// Add transactions
|
||||
for (int i = 0; i < model->rowCount(QModelIndex()) && i < Settings::getMaxMobileAppTxns(); i++) {
|
||||
txns.append(QJsonObject{
|
||||
{"type", model->getType(i)},
|
||||
|
||||
Reference in New Issue
Block a user