Show confirmations
This commit is contained in:
@@ -191,6 +191,7 @@ void Controller::getInfoThenRefresh(bool force) {
|
|||||||
|
|
||||||
static int lastBlock = 0;
|
static int lastBlock = 0;
|
||||||
int curBlock = reply["latest_block_height"].get<json::number_integer_t>();
|
int curBlock = reply["latest_block_height"].get<json::number_integer_t>();
|
||||||
|
model->setLatestBlock(curBlock);
|
||||||
//int version = reply["version"].get<json::string_t>();
|
//int version = reply["version"].get<json::string_t>();
|
||||||
int version = 1;
|
int version = 1;
|
||||||
Settings::getInstance()->setZcashdVersion(version);
|
Settings::getInstance()->setZcashdVersion(version);
|
||||||
@@ -334,8 +335,7 @@ void Controller::refreshTransactions() {
|
|||||||
return noConnection();
|
return noConnection();
|
||||||
|
|
||||||
zrpc->fetchTransactions([=] (json reply) {
|
zrpc->fetchTransactions([=] (json reply) {
|
||||||
QList<TransactionItem> txdata;
|
QList<TransactionItem> txdata;
|
||||||
|
|
||||||
|
|
||||||
for (auto& it : reply.get<json::array_t>()) {
|
for (auto& it : reply.get<json::array_t>()) {
|
||||||
QString address;
|
QString address;
|
||||||
@@ -369,7 +369,7 @@ void Controller::refreshTransactions() {
|
|||||||
it["block_height"].get<json::number_unsigned_t>(),
|
it["block_height"].get<json::number_unsigned_t>(),
|
||||||
address,
|
address,
|
||||||
QString::fromStdString(it["txid"]),
|
QString::fromStdString(it["txid"]),
|
||||||
1,
|
model->getLatestBlock() - it["block_height"].get<json::number_unsigned_t>(),
|
||||||
items
|
items
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -382,7 +382,7 @@ void Controller::refreshTransactions() {
|
|||||||
it["block_height"].get<json::number_unsigned_t>(),
|
it["block_height"].get<json::number_unsigned_t>(),
|
||||||
address,
|
address,
|
||||||
QString::fromStdString(it["txid"]),
|
QString::fromStdString(it["txid"]),
|
||||||
1,
|
model->getLatestBlock() - it["block_height"].get<json::number_unsigned_t>(),
|
||||||
items
|
items
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ DataModel::~DataModel() {
|
|||||||
delete taddresses;
|
delete taddresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataModel::setLatestBlock(int blockHeight) {
|
||||||
|
this->latestBlock = blockHeight;
|
||||||
|
}
|
||||||
|
|
||||||
void DataModel::replaceZaddresses(QList<QString>* newZ) {
|
void DataModel::replaceZaddresses(QList<QString>* newZ) {
|
||||||
QWriteLocker locker(lock);
|
QWriteLocker locker(lock);
|
||||||
Q_ASSERT(newZ);
|
Q_ASSERT(newZ);
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ public:
|
|||||||
|
|
||||||
void markAddressUsed(QString address);
|
void markAddressUsed(QString address);
|
||||||
|
|
||||||
|
void setLatestBlock(int blockHeight);
|
||||||
|
int getLatestBlock() { return this->latestBlock; }
|
||||||
|
|
||||||
const QList<QString> getAllZAddresses() { QReadLocker locker(lock); return *zaddresses; }
|
const QList<QString> getAllZAddresses() { QReadLocker locker(lock); return *zaddresses; }
|
||||||
const QList<QString> getAllTAddresses() { QReadLocker locker(lock); return *taddresses; }
|
const QList<QString> getAllTAddresses() { QReadLocker locker(lock); return *taddresses; }
|
||||||
const QList<UnspentOutput> getUTXOs() { QReadLocker locker(lock); return *utxos; }
|
const QList<UnspentOutput> getUTXOs() { QReadLocker locker(lock); return *utxos; }
|
||||||
@@ -33,7 +36,7 @@ public:
|
|||||||
DataModel();
|
DataModel();
|
||||||
~DataModel();
|
~DataModel();
|
||||||
private:
|
private:
|
||||||
|
int latestBlock;
|
||||||
|
|
||||||
QList<UnspentOutput>* utxos = nullptr;
|
QList<UnspentOutput>* utxos = nullptr;
|
||||||
QMap<QString, qint64>* balances = nullptr;
|
QMap<QString, qint64>* balances = nullptr;
|
||||||
|
|||||||
@@ -14,7 +14,12 @@ TxTableModel::~TxTableModel() {
|
|||||||
void TxTableModel::replaceData(const QList<TransactionItem>& data) {
|
void TxTableModel::replaceData(const QList<TransactionItem>& data) {
|
||||||
delete modeldata;
|
delete modeldata;
|
||||||
modeldata = new QList<TransactionItem>();
|
modeldata = new QList<TransactionItem>();
|
||||||
|
|
||||||
|
// Copy over the data and sort it
|
||||||
std::copy(data.begin(), data.end(), std::back_inserter(*modeldata));
|
std::copy(data.begin(), data.end(), std::back_inserter(*modeldata));
|
||||||
|
std::sort(modeldata->begin(), modeldata->end(), [=] (auto a, auto b) {
|
||||||
|
return a.datetime > b.datetime; // reverse sort
|
||||||
|
});
|
||||||
|
|
||||||
dataChanged(index(0, 0), index(modeldata->size()-1, columnCount(index(0,0))-1));
|
dataChanged(index(0, 0), index(modeldata->size()-1, columnCount(index(0,0))-1));
|
||||||
layoutChanged();
|
layoutChanged();
|
||||||
|
|||||||
Reference in New Issue
Block a user