refresh if conf=1
This commit is contained in:
@@ -216,6 +216,11 @@ void ChatModel::addrequestZaddr(QString tx, QString requestZaddr)
|
||||
this->requestZaddrMap[tx] = requestZaddr;
|
||||
}
|
||||
|
||||
void ChatModel::addconfirmations(QString tx, int confirmation)
|
||||
{
|
||||
this->confirmationsMap[tx] = confirmation;
|
||||
}
|
||||
|
||||
QString ChatModel::getCidByTx(QString tx)
|
||||
{
|
||||
for(auto& pair : this->cidMap)
|
||||
@@ -231,6 +236,21 @@ QString ChatModel::getCidByTx(QString tx)
|
||||
return QString("0xdeadbeef");
|
||||
}
|
||||
|
||||
QString ChatModel::getConfirmationByTx(QString tx)
|
||||
{
|
||||
for(auto& pair : this->confirmationsMap)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if(this->confirmationsMap.count(tx) > 0)
|
||||
{
|
||||
return this->confirmationsMap[tx];
|
||||
}
|
||||
|
||||
return QString("0xdeadbeef");
|
||||
}
|
||||
|
||||
QString ChatModel::getrequestZaddrByTx(QString tx)
|
||||
{
|
||||
for(auto& pair : this->requestZaddrMap)
|
||||
@@ -256,6 +276,11 @@ void ChatModel::killrequestZaddrCache()
|
||||
this->requestZaddrMap.clear();
|
||||
}
|
||||
|
||||
void ChatModel::killConfirmationCache()
|
||||
{
|
||||
this->confirmationsMap.clear();
|
||||
}
|
||||
|
||||
QString MainWindow::createHeaderMemo(QString type, QString cid, QString zaddr, int version=0, int headerNumber=1)
|
||||
{
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ class ChatModel
|
||||
MainWindow* main;
|
||||
std::map<QString, QString> cidMap;
|
||||
std::map<QString, QString> requestZaddrMap;
|
||||
std::map<QString, QString> confirmationsMap;
|
||||
std::map<int, std::tuple<QString, QString, QString>> sendrequestMap;
|
||||
|
||||
public:
|
||||
@@ -49,10 +50,13 @@ class ChatModel
|
||||
void addMessage(QString timestamp, ChatItem item);
|
||||
void addCid(QString tx, QString cid);
|
||||
void addrequestZaddr(QString tx, QString requestZaddr);
|
||||
void addconfirmations(QString tx, int confirmation);
|
||||
void addSendRequest(int i, QString myAddr, QString cid, QString addr );
|
||||
QString getCidByTx(QString tx);
|
||||
QString getrequestZaddrByTx(QString tx);
|
||||
QString getConfirmationByTx(QString tx);
|
||||
void killCidCache();
|
||||
void killConfirmationCache();
|
||||
void killrequestZaddrCache();
|
||||
|
||||
};
|
||||
|
||||
@@ -896,6 +896,16 @@ void Controller::refreshTransactions() {
|
||||
CAmount amount = CAmount::fromqint64(-1* o["value"].get<json::number_unsigned_t>());
|
||||
|
||||
// Check for Memos
|
||||
|
||||
if (confirmations == 0) {
|
||||
chatModel->addconfirmations(txid, confirmations);
|
||||
}
|
||||
|
||||
if ((confirmations == 1) && (chatModel->getConfirmationByTx(txid) != QString("0xdeadbeef"))){
|
||||
DataStore::getChatDataStore()->clear();
|
||||
chatModel->killConfirmationCache();
|
||||
this->refresh(true);
|
||||
}
|
||||
|
||||
QString memo;
|
||||
if (!o["memo"].is_null()) {
|
||||
@@ -912,10 +922,6 @@ void Controller::refreshTransactions() {
|
||||
isNotarized = false;
|
||||
}
|
||||
|
||||
if (confirmations == 1) {
|
||||
DataStore::getChatDataStore()->clear();
|
||||
this->refresh(true);
|
||||
}
|
||||
qDebug()<<"Conf : " << confirmations;
|
||||
|
||||
ChatItem item = ChatItem(
|
||||
@@ -932,10 +938,13 @@ void Controller::refreshTransactions() {
|
||||
isNotarized
|
||||
);
|
||||
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// this->refresh(true);
|
||||
items.push_back(TransactionItemDetail{address, amount, memo});
|
||||
total_amount = total_amount + amount;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user