From a030b20971fe8a87976c400c87c4d82dab2f71a4 Mon Sep 17 00:00:00 2001 From: Vlad Stan Date: Tue, 2 Aug 2022 12:59:41 +0300 Subject: [PATCH] fix: check network and masterpub for duplicate accounts --- lnbits/extensions/watchonly/views_api.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lnbits/extensions/watchonly/views_api.py b/lnbits/extensions/watchonly/views_api.py index faf003c2..0b052787 100644 --- a/lnbits/extensions/watchonly/views_api.py +++ b/lnbits/extensions/watchonly/views_api.py @@ -103,7 +103,14 @@ async def api_wallet_create_or_update( wallets = await get_watch_wallets(w.wallet.user, network["name"]) existing_wallet = next( - (ew for ew in wallets if ew.fingerprint == new_wallet.fingerprint), None + ( + ew + for ew in wallets + if ew.fingerprint == new_wallet.fingerprint + and ew.network == new_wallet.network + and ew.masterpub == new_wallet.masterpub + ), + None, ) if existing_wallet: raise ValueError(