Skip to content

Commit 44eae6a

Browse files
committed
add dcr recipient and mempool txs
1 parent 508a35c commit 44eae6a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

client/asset/dcr/dcr.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5710,7 +5710,8 @@ func (dcr *ExchangeWallet) checkPendingTxs(ctx context.Context, tip uint64) {
57105710
blockToQuery = tip - blockQueryBuffer
57115711
}
57125712

5713-
recentTxs, err := dcr.wallet.ListSinceBlock(ctx, int32(blockToQuery), int32(tip), int32(tip))
5713+
const rangeEndMempool = -1
5714+
recentTxs, err := dcr.wallet.ListSinceBlock(ctx, int32(blockToQuery), rangeEndMempool, int32(tip))
57145715
if err != nil {
57155716
dcr.log.Errorf("Error listing transactions since block %d: %v", blockToQuery, err)
57165717
recentTxs = nil
@@ -5748,7 +5749,12 @@ func (dcr *ExchangeWallet) checkPendingTxs(ctx context.Context, tip uint64) {
57485749
}
57495750
}
57505751

5751-
dcr.addTxToHistory(txType, txHash, toAtoms(tx.Amount), fee, nil, nil, true)
5752+
var addr *string
5753+
if txType == asset.Receive {
5754+
addr = &tx.Address
5755+
}
5756+
5757+
dcr.addTxToHistory(txType, txHash, toAtoms(tx.Amount), fee, nil, addr, true)
57525758
}
57535759

57545760
for _, tx := range recentTxs {
@@ -6071,6 +6077,10 @@ func (dcr *ExchangeWallet) monitorBlocks(ctx context.Context) {
60716077
if walletTip == nil {
60726078
// Mempool tx seen.
60736079
dcr.emitBalance()
6080+
dcr.tipMtx.RLock()
6081+
tipHeight := uint64(dcr.currentTip.height)
6082+
dcr.tipMtx.RUnlock()
6083+
go dcr.checkPendingTxs(ctx, tipHeight)
60746084
continue
60756085
}
60766086
if queuedBlock != nil && walletTip.height >= queuedBlock.height {

0 commit comments

Comments
 (0)