From bf593c30e4eeaf46bd22b1e53366abd769ad84bc Mon Sep 17 00:00:00 2001 From: Mud <44410798+MudDev@users.noreply.github.com> Date: Thu, 10 Sep 2020 15:37:45 -0600 Subject: [PATCH] Added the Bech32Address to GetAddressBalance() The GetAddressBalance() method does not return any results when using a segwit address. This change fixes this. --- src/Features/Blockcore.Features.Wallet/WalletManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Features/Blockcore.Features.Wallet/WalletManager.cs b/src/Features/Blockcore.Features.Wallet/WalletManager.cs index f677036ca..683237f33 100644 --- a/src/Features/Blockcore.Features.Wallet/WalletManager.cs +++ b/src/Features/Blockcore.Features.Wallet/WalletManager.cs @@ -856,7 +856,7 @@ public AddressBalance GetAddressBalance(string address) foreach (Types.Wallet wallet in this.Wallets) { - hdAddress = wallet.GetAllAddresses().FirstOrDefault(a => a.Address == address); + hdAddress = wallet.GetAllAddresses().FirstOrDefault(a => a.Address == address || a.Bech32Address == address); if (hdAddress == null) continue; // When this query to get balance on specific address, we will exclude the cold staking UTXOs. @@ -2067,4 +2067,4 @@ public ExtKey GetExtKey(WalletAccountReference accountReference, string password return new ExtKey(privateKey, wallet.ChainCode); } } -} \ No newline at end of file +}