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