Reverts: 7e96b45ea0c51ca5589640018172a91a35596148 which broke this regex for the 0x0 edge-case

This commit is contained in:
Fabio Berger 2017-05-30 09:53:55 +02:00
parent 7b9e8777f1
commit 000e364406

View File

@ -50,7 +50,7 @@ export class Web3Wrapper {
public async doesContractExistAtAddressAsync(address: string): Promise<boolean> { public async doesContractExistAtAddressAsync(address: string): Promise<boolean> {
const code = await promisify(this.web3.eth.getCode)(address); const code = await promisify(this.web3.eth.getCode)(address);
// Regex matches 0x0, 0x00, 0x in order to accomodate poorly implemented clients // Regex matches 0x0, 0x00, 0x in order to accomodate poorly implemented clients
const zeroHexAddressRegex = /^0x0\{0,40\}$/i; const zeroHexAddressRegex = /^0x0*$/i;
const didFindCode = _.isNull(code.match(zeroHexAddressRegex)); const didFindCode = _.isNull(code.match(zeroHexAddressRegex));
return didFindCode; return didFindCode;
} }