Skip to content

Commit

Permalink
Merge pull request #622 from dashpay/fix/sync-progress-overflow
Browse files Browse the repository at this point in the history
fix: sync progress overflow
  • Loading branch information
pankcuf authored Nov 16, 2023
2 parents 29d03e3 + 9ae0fc5 commit 3eb67e0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DashSyncCurrentCommit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d49baf929a3817e3777465817ec9c6b4d65e2666
f533c7cb13b7b89bc1f6682774a808c61565974d
2 changes: 1 addition & 1 deletion DashWallet/Sources/Categories/DSChain+DashWallet.m
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ - (uint64_t)calculateMasternodePaymentWithHeight:(uint64_t)height blockReward:(u
return ret;
}

if (height >= chain_core20_activation_height(self.chainType)) {
if ([self isCore20ActiveAtHeight:height]) {
// Once MNRewardReallocated activates, block reward is 80% of block subsidy (+ tx fees) since treasury is 20%
// Since the MN reward needs to be equal to 60% of the block subsidy (according to the proposal), MN reward is set to 75% of the block reward.
// Previous reallocation periods are dropped.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ final class SyncingAlertContentView: UIView {
let atTheEndOfSyncBlocksAndSyncingMasternodeList = chain.lastSyncBlockHeight >= chain.estimatedBlockHeight - 6 && chainManager.masternodeManager
.masternodeListRetrievalQueueCount > 0 && chainManager.syncPhase == .synced
if atTheEndOfInitialTerminalBlocksAndSyncingMasternodeList || atTheEndOfSyncBlocksAndSyncingMasternodeList {
subtitleLabel.text = String(format: NSLocalizedString("masternode list #%d of %d", comment: ""),
chainManager.masternodeManager.masternodeListRetrievalQueueMaxAmount - chainManager.masternodeManager.masternodeListRetrievalQueueCount,
chainManager.masternodeManager.masternodeListRetrievalQueueMaxAmount)
let remaining = max(0, chainManager.masternodeManager.masternodeListRetrievalQueueMaxAmount - chainManager.masternodeManager.masternodeListRetrievalQueueCount)
subtitleLabel.text = String(format: NSLocalizedString("masternode list #%d of %d", comment: ""), remaining, chainManager.masternodeManager.masternodeListRetrievalQueueMaxAmount)
} else {
if chainManager.syncPhase == .initialTerminalBlocks {
subtitleLabel.text = String(format: NSLocalizedString("header #%d of %d", comment: ""), chain.lastTerminalBlockHeight, chain.estimatedBlockHeight)
Expand All @@ -141,7 +140,7 @@ final class SyncingAlertContentView: UIView {
}

func update(with progress: Double) {
titleLabel.text = String(format: "%@ %.1f%%", NSLocalizedString("Syncing", comment: ""), progress * 100.0)
titleLabel.text = String(format: "%@ %.1f%%", NSLocalizedString("Syncing", comment: ""), min(max(progress, 0), 1) * 100.0)
}

func showAnimation() {
Expand Down
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -866,4 +866,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 8dff55782a9c478127464baadc00c6fc85af48ba

COCOAPODS: 1.12.1
COCOAPODS: 1.14.2

0 comments on commit 3eb67e0

Please sign in to comment.