Skip to content

Commit

Permalink
Merge pull request #4516 from BitGo/BTC-1084-bch
Browse files Browse the repository at this point in the history
feat: use canonical address when checking if owned by wallet
  • Loading branch information
lcovar authored May 8, 2024
2 parents db0cca1 + 82a13bd commit 105d1e0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/abstract-utxo/src/recovery/crossChainRecovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ async function getAllRecoveryOutputs<TNumber extends number | bigint = number>(
const walletAddresses = (
await Promise.all(
tx.outputs.map(async (output) => {
const isWalletOwned = await isWalletAddress(wallet, output.address);
// For some coins (bch) we need to convert the address to legacy format since the api returns the address
// in non legacy format. However, we want to keep the address in the same format as the response since we
// are going to hit the API again to fetch address unspents.
const canonicalAddress = coin.canonicalAddress(output.address);
const isWalletOwned = await isWalletAddress(wallet, canonicalAddress);
return isWalletOwned ? output.address : null;
})
)
Expand Down

0 comments on commit 105d1e0

Please sign in to comment.