Skip to content

Commit 8e4b1da

Browse files
jholdstockjrick
authored andcommitted
[release-v2.0] loader: Only create mix client if mixing enabled.
wallet.Config is created in three separate places (create new wallet, open existing wallet, watch only wallet). DisableMixing was only being set correctly in one of those (watch only). As a result, a MixClient would always be created regardless of config set by the user. Backport of 7552d0b.
1 parent b47c4de commit 8e4b1da

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

internal/loader/loader.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ func (l *Loader) CreateNewWallet(ctx context.Context, pubPassphrase, privPassphr
277277
WatchLast: l.watchLast,
278278
AccountGapLimit: l.accountGapLimit,
279279
DisableCoinTypeUpgrades: l.disableCoinTypeUpgrades,
280+
DisableMixing: l.disableMixing,
280281
StakePoolColdExtKey: so.StakePoolColdExtKey,
281282
ManualTickets: l.manualTickets,
282283
AllowHighFees: l.allowHighFees,
@@ -338,6 +339,7 @@ func (l *Loader) OpenExistingWallet(ctx context.Context, pubPassphrase []byte) (
338339
WatchLast: l.watchLast,
339340
AccountGapLimit: l.accountGapLimit,
340341
DisableCoinTypeUpgrades: l.disableCoinTypeUpgrades,
342+
DisableMixing: l.disableMixing,
341343
StakePoolColdExtKey: so.StakePoolColdExtKey,
342344
ManualTickets: l.manualTickets,
343345
AllowHighFees: l.allowHighFees,

wallet/chainntfns.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,9 @@ func (w *Wallet) ChainSwitch(ctx context.Context, forest *SidechainForest, chain
277277
forest.PruneChain(chain)
278278
forest.Prune(int32(chain[len(chain)-1].Header.Height), w.chainParams)
279279

280-
w.mixClient.ExpireMessages(chain[len(chain)-1].Header.Height)
280+
if w.mixing {
281+
w.mixClient.ExpireMessages(chain[len(chain)-1].Header.Height)
282+
}
281283

282284
w.NtfnServer.notifyMainChainTipChanged(chainTipChanges)
283285
w.NtfnServer.sendAttachedBlockNotification(ctx)

0 commit comments

Comments
 (0)