Merge pull request #3618 from cake-tech/fix/cw-1647-lightning-withdraw-address
What changed, and why it matters
This change fixes a bug in Cake Wallet's Lightning send screen. Previously, if a user typed a custom withdrawal address and then switched between wallets, the app could ignore the manually entered address and fall back to the wallet's own address. The fix ensures the app respects the address the user actually typed. This is a correctness/UX bug with possible security implications (sending funds to the wrong place), but the commit itself is a fix, not an attack.
Treat as a low-to-moderate bug fix. Verify the fix through QA on Lightning send flows with manually entered addresses and wallet switching. No immediate incident response is warranted absent reports of exploited losses.
Security signals we found
UI state desynchronization between address input and wallet selector
Potential incorrect recipient address selection in Lightning withdrawals
Fix for user-supplied address being ignored
Evidence from the diff
In l2_action_wallet_selector.dart, the condition for updating sendViewModel.outputs.first.address was previously triggered only when the selected wallet name differed from the current wallet. The patch adds an additional trigger: if addressController.text is non-empty, the output address is updated to the controller’s text (or falls back to the wallet’s address if empty). This prevents the UI from silently discarding a user-entered Lightning withdrawal address during wallet selection changes.
Changed components
lib/new-ui/widgets/send_page/l2_action_wallet_selector.dartLightning withdrawal/send flowL2 wallet selector widgetInspect captured patch +3 / −2
### lib/new-ui/widgets/send_page/l2_action_wallet_selector.dart
@@ -279,8 +279,9 @@ class _L2ActionWalletSelectorState extends State<L2ActionWalletSelector> {
if (widget.action == L2Actions.deposit) {
await _handleChangeWallet(items[_selectedWalletIndex]);
} else {
- if (items[_selectedWalletIndex].name !=
- widget.sendViewModel.wallet.name) {
+ if (addressController.text.isNotEmpty ||
+ items[_selectedWalletIndex].name !=
+ widget.sendViewModel.wallet.name) {
widget.sendViewModel.outputs.first.address =
addressController.text.isNotEmpty
? addressController.textWhy this scored 44/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.