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

client/dcr: Mixing Tx History #2853

Merged
merged 2 commits into from
Aug 12, 2024
Merged

client/dcr: Mixing Tx History #2853

merged 2 commits into from
Aug 12, 2024

Conversation

martonp
Copy link
Contributor

@martonp martonp commented Jun 30, 2024

This diff handles identifying decred mixing transactions when adding them to the transaction history. For RPC wallets, a separate transaction history db is created for each set of unmixed/trading/mixed accounts configuration.

Closes #2824

client/asset/dcr/spv.go Outdated Show resolved Hide resolved
client/asset/dcr/spv.go Outdated Show resolved Hide resolved
client/asset/dcr/dcr.go Outdated Show resolved Hide resolved
Comment on lines 4830 to 4851
previouslySynced := dcr.previouslySynced.Load()
if err != nil {
dcr.previouslySynced.Store(false)
return
}
dcr.previouslySynced.Store(synced)

if !previouslySynced && synced {
dcr.tipMtx.RLock()
tip := dcr.currentTip
dcr.tipMtx.RUnlock()

dcr.syncTxHistory(dcr.ctx, uint64(tip.height))
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little bit cleaner, I think

if wasSynced := dcr.previouslySynced.Swap(synced); synced && !wasSynced {
	dcr.tipMtx.RLock()
	tip := dcr.currentTip
	dcr.tipMtx.RUnlock()

	dcr.syncTxHistory(dcr.ctx, uint64(tip.height))
}

This diff handles identifying decred mixing transactions when adding them
to the transaction history. Also, it updates the UI to allow hiding
mixing transactions.
@@ -971,6 +974,7 @@ export default class WalletsPage extends BasePage {
for (const b of assetSelect.children) b.classList.remove('selected')
this.assetButtons[assetID].bttn.classList.add('selected')
this.selectedAssetID = assetID
this.page.hideMixTxsCheckbox.checked = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be remembered, but I'm not gonna push it now.

Comment on lines +1874 to +1883
async getTxHistory (assetID: number, hideMixTxs: boolean, after?: string) : Promise<TxHistoryResult> {
let numToFetch = 10
if (hideMixTxs) numToFetch = 15

const res : TxHistoryResult = { txs: [], lastTx: false }
let ref = after

for (let i = 0; i < 40; i++) {
const currRes = await app().txHistory(assetID, numToFetch, ref)
if (currRes.txs.length > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of a hack. We should be passing a filter all the way in to the wallet.

@buck54321 buck54321 merged commit b2addc7 into decred:master Aug 12, 2024
5 checks passed
buck54321 pushed a commit that referenced this pull request Aug 12, 2024
* client/dcr: Mixing Tx History

This diff handles identifying decred mixing transactions when adding them
to the transaction history. Also, it updates the UI to allow hiding
mixing transactions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Privacy Mixing Transactions labeled "Send" - Scary UX
3 participants