mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-01-19 05:45:15 +01:00
FIX: Check Bech32 uppercase address
This commit is contained in:
parent
163f275a06
commit
79f21946fb
@ -824,11 +824,17 @@ export class AbstractHDElectrumWallet extends AbstractHDWallet {
|
||||
}
|
||||
|
||||
weOwnAddress(address) {
|
||||
let cleanAddress = address;
|
||||
|
||||
if (this.segwitType === 'p2wpkh') {
|
||||
cleanAddress = address.toLowerCase();
|
||||
}
|
||||
|
||||
for (let c = 0; c < this.next_free_address_index + this.gap_limit; c++) {
|
||||
if (this._getExternalAddressByIndex(c) === address) return true;
|
||||
if (this._getExternalAddressByIndex(c) === cleanAddress) return true;
|
||||
}
|
||||
for (let c = 0; c < this.next_free_change_address_index + this.gap_limit; c++) {
|
||||
if (this._getInternalAddressByIndex(c) === address) return true;
|
||||
if (this._getInternalAddressByIndex(c) === cleanAddress) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -465,7 +465,13 @@ export class LegacyWallet extends AbstractWallet {
|
||||
}
|
||||
|
||||
weOwnAddress(address) {
|
||||
return this.getAddress() === address || this._address === address;
|
||||
let cleanAddress = address;
|
||||
|
||||
if (this.segwitType === 'p2wpkh') {
|
||||
cleanAddress = address.toLowerCase();
|
||||
}
|
||||
|
||||
return this.getAddress() === cleanAddress || this._address === cleanAddress;
|
||||
}
|
||||
|
||||
weOwnTransaction(txid) {
|
||||
|
@ -40,6 +40,7 @@ describe('Bech32 Segwit HD (BIP84)', () => {
|
||||
assert.strictEqual(hd._getInternalAddressByIndex(1), 'bc1qwp58x4c9e5cplsnw5096qzdkae036ug7a34x3r');
|
||||
|
||||
assert.ok(hd.weOwnAddress('bc1qvd6w54sydc08z3802svkxr7297ez7cusd6266p'));
|
||||
assert.ok(hd.weOwnAddress('BC1QVD6W54SYDC08Z3802SVKXR7297EZ7CUSD6266P'));
|
||||
assert.ok(hd.weOwnAddress('bc1qt4t9xl2gmjvxgmp5gev6m8e6s9c85979ta7jeh'));
|
||||
assert.ok(!hd.weOwnAddress('1HjsSTnrwWzzEV2oi4r5MsAYENkTkrCtwL'));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user