From 72436c90b29844cf507895df053103f9b6840776 Mon Sep 17 00:00:00 2001 From: ak Date: Fri, 8 Feb 2019 20:50:21 +0900 Subject: [PATCH] Sugarchain: GUI: reduce lock call: pollBalanceChanged fix: QT Wallet Freeze resolved. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do update Balances in QT GUI every 60 sec. Instead of every blocks. Description in Korean: TX 이력이 많은 Large wallet 예를들면 마이닝풀, 에서QT지갑의 잔액 상황을 보여줄때 딜레이가 발생하고 이것은 5초 마다 발생하는데 이 딜레이 셧다운이 3초이상으로 길어지면 거의 계속 멈춘상태로 QT지갑을 사용하기 어려워진다. 그래서 업데이트 간격을 every block 에서 12 blocks (약 60초) 간격으로 늘린다. 대신 잔액 업데이트가 1분간격으로 이루어지며 딜레이로 인한 랙장애는 없다. 참고로 비트코인은 10분에 1회 이루어 진다. 이 해결책은 원본 비트코인지갑의 known issue에 대한 해결책이며 workaround에 속한다. 비트코인 개발자들의 지속적인 업데이트를 주시한다. 증상: QT지갑의 잦은 랙으로 인한 사용불가 현상 (경미) 마이닝풀에서 해시가 늘어나지 않는 현상 (심각) 해결된것: QT지갑의 지연이 60초 간격으로 lockMain 주기를 완화시킴으로 해결. Ref: https://github.com/Bitcoin-ABC/bitcoin-abc/issues/49 https://github.com/bitcoin/bitcoin/issues/10504 https://github.com/bitcoin/bitcoin/issues/15148 https://github.com/bitcoin/bitcoin/issues/10349 https://github.com/bitcoin/bitcoin/issues/5851 https://github.com/bitcoin/bitcoin/pull/13612 --- src/qt/walletmodel.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 4d7e977fc..9faf077c8 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -113,6 +113,7 @@ void WalletModel::updateStatus() Q_EMIT encryptionStatusChanged(newEncryptionStatus); } +// FIXME.SUGAR // SURE? void WalletModel::pollBalanceChanged() { // Get required locks upfront. This avoids the GUI from getting stuck on @@ -129,12 +130,28 @@ void WalletModel::pollBalanceChanged() { fForceCheckBalanceChanged = false; + // BEGIN - DEBUG for checking height? + printf(" %d = height \n", chainActive.Height()); + printf(" %d = cached \n", cachedNumBlocks); + printf("height - cached = %d \n", (int)(chainActive.Height() - cachedNumBlocks)); + // END - DEBUG for checking height? + + // FIXME.SUGAR // SURE? + // update every blocks >> 12 blocks // 5*12 = 60s + if(chainActive.Height() - cachedNumBlocks >= 12) + { + // BEGIN - DEBUG for checking polled? + printf("\033[0;31m pollBalanceChanged: \033[0m \n"); // red + printf("height - cached = %d \n", (int)(chainActive.Height() - cachedNumBlocks)); + // END - DEBUG for checking polled? + // Balance and number of transactions might have changed cachedNumBlocks = chainActive.Height(); checkBalanceChanged(); if(transactionTableModel) transactionTableModel->updateConfirmations(); + } } }