Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Narrow rules of what is considered a possible coinjoin #1961

Merged
merged 1 commit into from
Jan 12, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions wallet/mixing.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,17 @@ func PossibleCoinJoin(tx *wire.MsgTx) (isMix bool, mixDenom int64, mixCount uint
numberOfInputs := len(tx.TxIn)

mixedOuts := make(map[int64]uint32)
scripts := make(map[string]int)
for _, o := range tx.TxOut {
scripts[string(o.PkScript)]++
if scripts[string(o.PkScript)] > 1 {
return false, 0, 0
}
val := o.Value
// Multiple zero valued outputs do not count as a coinjoin mix.
if val == 0 {
continue
}
mixedOuts[val]++
}

Expand Down
3 changes: 3 additions & 0 deletions wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -5230,6 +5230,9 @@ func (w *Wallet) getCoinjoinTxsSumbByAcct(ctx context.Context) (map[uint32]int,
_, tipHeight := w.txStore.MainChainTip(dbtx)
rangeFn := func(details []udb.TxDetails) (bool, error) {
for _, detail := range details {
if detail.TxType != stake.TxTypeRegular {
continue
}
isMixedTx, mixDenom, _ := PossibleCoinJoin(&detail.MsgTx)
if !isMixedTx {
continue
Expand Down