Skip to content

Commit

Permalink
Sugarchain: GUI: reduce lock call: pollBalanceChanged
Browse files Browse the repository at this point in the history
fix: QT Wallet Freeze resolved.

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:
Bitcoin-ABC/bitcoin-abc#49
bitcoin/bitcoin#10504
bitcoin/bitcoin#15148
bitcoin/bitcoin#10349
bitcoin/bitcoin#5851
bitcoin/bitcoin#13612
  • Loading branch information
ak committed Feb 8, 2019
1 parent ba1e7ad commit 72436c9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}
}
}

Expand Down

0 comments on commit 72436c9

Please sign in to comment.