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

dcr: Remove tx history wait. #3005

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
21 changes: 5 additions & 16 deletions client/asset/dcr/dcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down
Loading