Skip to content

Commit 0567ec5

Browse files
committed
Respect --changeaccount with unmixed ticket autobuying
There is currently no way to set the change account used by individual split transactions when running the ticket autobuyer without mixing, as this account was never looked up from the config. Allow the change account to be specified with unmixed ticket buying, defaulting to the purchase account if it is unset. The change account remains required if mixing is enabled.
1 parent e138188 commit 0567ec5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ type config struct {
174174
mixedAccount string
175175
mixedBranch uint32
176176
TicketSplitAccount string `long:"ticketsplitaccount" description:"Account to derive fresh addresses from for mixed ticket splits; uses mixedaccount if unset"`
177-
ChangeAccount string `long:"changeaccount" description:"Account used to derive unmixed CoinJoin outputs in CoinShuffle++ protocol"`
177+
ChangeAccount string `long:"changeaccount" description:"Account to send change when ticket autobuying or mixing; required when mixing"`
178178
MixChange bool `long:"mixchange" description:"Use CoinShuffle++ to mix change account outputs into mix account"`
179179
MixSplitLimit int `long:"mixsplitlimit" description:"Maximum concurrent mixes for any change amount"`
180180

dcrwallet.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ func run(ctx context.Context) error {
301301
purchaseAccount uint32 // enableticketbuyer
302302
votingAccount uint32 // enableticketbuyer
303303
mixedAccount uint32 // (enableticketbuyer && mixing) || mixchange
304-
changeAccount uint32 // (enableticketbuyer && mixing) || mixchange
304+
changeAccount uint32 // enableticketbuyer || mixchange
305305
ticketSplitAccount uint32 // enableticketbuyer && mixing
306306
)
307307
if cfg.EnableTicketBuyer {
@@ -317,6 +317,11 @@ func run(ctx context.Context) error {
317317
} else {
318318
votingAccount = purchaseAccount
319319
}
320+
if cfg.ChangeAccount != "" {
321+
changeAccount = lookup("changeaccount", cfg.ChangeAccount)
322+
} else {
323+
changeAccount = purchaseAccount
324+
}
320325
}
321326
if (cfg.EnableTicketBuyer && cfg.MixingEnabled) || cfg.MixChange {
322327
mixedAccount = lookup("mixedaccount", cfg.mixedAccount)

0 commit comments

Comments
 (0)