Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ require (
github.com/decred/dcrd/rpc/jsonrpc/types/v4 v4.4.0
github.com/decred/dcrd/rpcclient/v8 v8.1.0
github.com/decred/dcrd/txscript/v4 v4.1.2
github.com/decred/dcrd/wire v1.7.1
github.com/decred/dcrd/wire v1.7.2
github.com/decred/go-socks v1.1.0
github.com/decred/slog v1.2.0
github.com/decred/vspd/client/v4 v4.0.1
github.com/decred/vspd/client/v4 v4.0.2
github.com/decred/vspd/types/v3 v3.0.0
github.com/gorilla/websocket v1.5.1
github.com/jessevdk/go-flags v1.5.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ github.com/decred/dcrd/rpcclient/v8 v8.1.0 h1:FLZ1j4ub7+O9oCIcKf+frYCrZW++G3FSzk
github.com/decred/dcrd/rpcclient/v8 v8.1.0/go.mod h1:iTHqLrHnS2VLJPHQk7guy0BP3jKvMew9STDqWWhFNA4=
github.com/decred/dcrd/txscript/v4 v4.1.2 h1:1EP7ZmBDl2LBeAMTEygxY8rVNN3+lkGqrsb4u64x+II=
github.com/decred/dcrd/txscript/v4 v4.1.2/go.mod h1:r5/8qfCnl6TFrE369gggUayVIryM1oC7BLoRfa27Ckw=
github.com/decred/dcrd/wire v1.7.1 h1:kDuHBiY1Qv9rBxYKgC2RgyPy7IOA2WRf00jqHwpr16I=
github.com/decred/dcrd/wire v1.7.1/go.mod h1:eP9XRsMloy+phlntkTAaAm611JgLv8NqY1YJoRxkNKU=
github.com/decred/dcrd/wire v1.7.2 h1:04vpHHE3t78rDztjZx82JV2EEOMDUtUUB1347H32kho=
github.com/decred/dcrd/wire v1.7.2/go.mod h1:eP9XRsMloy+phlntkTAaAm611JgLv8NqY1YJoRxkNKU=
github.com/decred/go-socks v1.1.0 h1:dnENcc0KIqQo3HSXdgboXAHgqsCIutkqq6ntQjYtm2U=
github.com/decred/go-socks v1.1.0/go.mod h1:sDhHqkZH0X4JjSa02oYOGhcGHYp12FsY1jQ/meV8md0=
github.com/decred/slog v1.2.0 h1:soHAxV52B54Di3WtKLfPum9OFfWqwtf/ygf9njdfnPM=
github.com/decred/slog v1.2.0/go.mod h1:kVXlGnt6DHy2fV5OjSeuvCJ0OmlmTF6LFpEPMu/fOY0=
github.com/decred/vspd/client/v4 v4.0.1 h1:eoFWCoaqEMLBODRQrVABGcpFrFdOSPLiMWpPO+RVvi0=
github.com/decred/vspd/client/v4 v4.0.1/go.mod h1:jhqu4KGGOskQcPVZ3XZLVZ1Wgkc9GQo+oEipr3gGODg=
github.com/decred/vspd/client/v4 v4.0.2 h1:yvQaJFy3UdQMcRzjAyvuKPpr2G2Rn6Bbha+HH4TwItQ=
github.com/decred/vspd/client/v4 v4.0.2/go.mod h1:jhqu4KGGOskQcPVZ3XZLVZ1Wgkc9GQo+oEipr3gGODg=
github.com/decred/vspd/types/v3 v3.0.0 h1:jHlQIpp6aCjIcFs8WE3AaVCJe1kgepNTq+nkBKAyQxk=
github.com/decred/vspd/types/v3 v3.0.0/go.mod h1:hwifRZu6tpkbhSg2jZCUwuPaO/oETgbSCWCYJd4XepY=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const semverAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrst
const (
Major = 2
Minor = 1
Patch = 1
Patch = 2
)

// Integer is an integer encoding of the major.minor.patch version.
Expand Down
2 changes: 1 addition & 1 deletion wallet/addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ func (w *Wallet) markUsedAddress(op errors.Op, dbtx walletdb.ReadWriteTx, addr u
if err != nil {
return errors.E(op, err)
}
log.Debugf("Marked address %v used", addr)
log.Debugf("Marked address %s used", addr.Address())
return nil
}

Expand Down
4 changes: 1 addition & 3 deletions wallet/chainntfns.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,7 @@ func (w *Wallet) ChainSwitch(ctx context.Context, forest *SidechainForest, chain
forest.PruneChain(chain)
forest.Prune(int32(chain[len(chain)-1].Header.Height), w.chainParams)

if w.mixingEnabled {
w.mixClient.ExpireMessages(chain[len(chain)-1].Header.Height)
}
w.expireMixMessages(chain[len(chain)-1].Header.Height)

w.NtfnServer.notifyMainChainTipChanged(chainTipChanges)
w.NtfnServer.sendAttachedBlockNotification(ctx)
Expand Down
2 changes: 1 addition & 1 deletion wallet/createtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ func (w *Wallet) mixedSplit(ctx context.Context, req *PurchaseTicketsRequest, ne
}
}

err = w.mixClient.Dicemix(ctx, cj)
err = w.dicemix(ctx, cj)
if err != nil {
return
}
Expand Down
18 changes: 17 additions & 1 deletion wallet/mixing.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ SplitPoints:

log.Infof("Mixing output %v (%v)", output, amount)

err = w.mixClient.Dicemix(ctx, cj)
err = w.dicemix(ctx, cj)
if err != nil {
return errors.E(op, err)
}
Expand Down Expand Up @@ -561,3 +561,19 @@ func (w *Wallet) AcceptMixMessage(msg mixing.Message) error {

return nil
}

func (w *Wallet) expireMixMessages(height uint32) {
mixc := w.mixClient.Load()
if mixc == nil {
return
}
mixc.ExpireMessages(height)
}

func (w *Wallet) dicemix(ctx context.Context, cj *mixclient.CoinJoin) error {
mixc := w.mixClient.Load()
if mixc == nil {
return errors.E(errors.Invalid, "mixing client is not running")
}
return mixc.Dicemix(ctx, cj)
}
14 changes: 10 additions & 4 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ type Wallet struct {
mixingEnabled bool
mixpool *mixpool.Pool
mixSems mixSemaphores
mixClient *mixclient.Client
mixClient atomic.Pointer[mixclient.Client]

// Cached Blake3 anchor candidate
cachedBlake3WorkDiffCandidateAnchor *wire.BlockHeader
Expand Down Expand Up @@ -5523,8 +5523,6 @@ func Open(ctx context.Context, cfg *Config) (*Wallet, error) {

if w.mixingEnabled {
w.mixpool = mixpool.NewPool((*mixpoolBlockchain)(w))
w.mixClient = mixclient.NewClient((*mixingWallet)(w))
w.mixClient.SetLogger(loggers.MixcLog)
}

return w, nil
Expand All @@ -5536,10 +5534,18 @@ func (w *Wallet) MixingEnabled() bool {
return w.mixingEnabled
}

func newMixClient(w *Wallet) *mixclient.Client {
c := mixclient.NewClient((*mixingWallet)(w))
c.SetLogger(loggers.MixcLog)
return c
}

// Run executes any necessary background goroutines for the wallet.
func (w *Wallet) Run(ctx context.Context) error {
if w.mixingEnabled {
return w.mixClient.Run(ctx)
c := newMixClient(w)
w.mixClient.Store(c)
return c.Run(ctx)
}
return nil
}
Expand Down
Loading