From ec312e6851d5c63982c252ea92c99c8b4282b55f Mon Sep 17 00:00:00 2001 From: JoeGruff Date: Thu, 3 Oct 2024 21:12:13 +0900 Subject: [PATCH] dcr: Remove tx history wait. SyncStatus has a chance to hold the tipMtx so run it in a goroutine and do not wait. --- client/asset/dcr/dcr.go | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/client/asset/dcr/dcr.go b/client/asset/dcr/dcr.go index 87481252a9..3dfaf4e85e 100644 --- a/client/asset/dcr/dcr.go +++ b/client/asset/dcr/dcr.go @@ -5936,7 +5936,7 @@ func isMixTx(tx *wire.MsgTx) (isMix bool, mixDenom int64) { } // idUnknownTx identifies the type and details of a transaction either made -// or recieved by the wallet. +// or received by the wallet. func (dcr *ExchangeWallet) idUnknownTx(ctx context.Context, tx *ListTransactionsResult) (*asset.WalletTransaction, error) { txHash, err := chainhash.NewHashFromStr(tx.TxID) if err != nil { @@ -6252,7 +6252,7 @@ func (dcr *ExchangeWallet) idUnknownTx(ctx context.Context, tx *ListTransactions } // addUnknownTransactionsToHistory checks for any transactions the wallet has -// made or recieved that are not part of the transaction history. It scans +// made or received that are not part of the transaction history. It scans // from the last point to which it had previously scanned to the current tip. func (dcr *ExchangeWallet) addUnknownTransactionsToHistory(tip uint64) { txHistoryDB := dcr.txDB() @@ -6320,7 +6320,7 @@ func (dcr *ExchangeWallet) addUnknownTransactionsToHistory(tip uint64) { } // syncTxHistory checks to see if there are any transactions which the wallet -// has made or recieved that are not part of the transaction history, then +// has made or received that are not part of the transaction history, then // identifies and adds them. It also checks all the pending transactions to see // if they have been mined into a block, and if so, updates the transaction // history to reflect the block height. @@ -6699,12 +6699,7 @@ func (dcr *ExchangeWallet) handleTipChange(ctx context.Context, newTipHash *chai dcr.cycleMixer() } - var wg sync.WaitGroup - wg.Add(1) - go func() { - defer wg.Done() - dcr.syncTxHistory(ctx, uint64(newTipHeight)) - }() + go dcr.syncTxHistory(ctx, uint64(newTipHeight)) // Search for contract redemption in new blocks if there // are contracts pending redemption. @@ -6759,13 +6754,7 @@ func (dcr *ExchangeWallet) handleTipChange(ctx context.Context, newTipHash *chai // Run the redemption search from the startHeight determined above up // till the current tip height. - wg.Add(1) - go func() { - defer wg.Done() - dcr.findRedemptionsInBlockRange(startHeight, newTipHeight, contractOutpoints) - }() - - wg.Wait() + dcr.findRedemptionsInBlockRange(startHeight, newTipHeight, contractOutpoints) } func (dcr *ExchangeWallet) getBestBlock(ctx context.Context) (*block, error) {