Skip to content

Commit

Permalink
Update deposit address due to TransactionNote
Browse files Browse the repository at this point in the history
  • Loading branch information
martonp committed Jan 31, 2024
1 parent 64825c9 commit 296ae25
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions client/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -9646,6 +9646,23 @@ func (c *Core) handleWalletNotification(ni asset.WalletNotification) {
c.log.Errorf("Error storing and sending emitted balance: %v", err)
}
return // Notification sent already.
case *asset.TransactionNote:
if n.Transaction.Type != asset.Receive || n.Transaction.Recipient == nil {
break
}
w, ok := c.wallet(n.AssetID)
if !ok {
return
}
currentAddress := w.currentDepositAddress()
if currentAddress == *n.Transaction.Recipient {
updatedAddr, err := c.NewDepositAddress(n.AssetID)
if err != nil {
c.log.Errorf("Error getting new deposit address for %s: %v", unbip(n.AssetID), err)
break
}
c.log.Debugf("Deposit address for %s has changed from %s to %s", unbip(n.AssetID), currentAddress, updatedAddr)
}
}
c.notify(newWalletNote(ni))
}
Expand Down

0 comments on commit 296ae25

Please sign in to comment.