Commit e31060aa authored by yann300's avatar yann300

check bytecode (take in account ctor parameters)

parent 1e65fec8
...@@ -50,7 +50,7 @@ class SolidityProxy { ...@@ -50,7 +50,7 @@ class SolidityProxy {
this.codeManager.getCode(address, (error, code) => { this.codeManager.getCode(address, (error, code) => {
if (error) { if (error) {
cb(error) cb(error)
} else { } else {
var contractName = contractNameFromCode(this.contracts, code.bytecode, address) var contractName = contractNameFromCode(this.contracts, code.bytecode, address)
this.cache.contractNameByAddress[address] = contractName this.cache.contractNameByAddress[address] = contractName
cb(null, contractName) cb(null, contractName)
...@@ -137,7 +137,7 @@ function contractNameFromCode (contracts, code, address) { ...@@ -137,7 +137,7 @@ function contractNameFromCode (contracts, code, address) {
var isCreation = traceHelper.isContractCreation(address) var isCreation = traceHelper.isContractCreation(address)
var byteProp = isCreation ? 'bytecode' : 'runtimeBytecode' var byteProp = isCreation ? 'bytecode' : 'runtimeBytecode'
for (var k in contracts) { for (var k in contracts) {
if ('0x' + contracts[k][byteProp].replace(util.swarmHashExtraction(), '') === code.replace(util.swarmHashExtraction(), '')) { if (code.replace(util.swarmHashExtraction(), '').indexOf('0x' + contracts[k][byteProp].replace(util.swarmHashExtraction(), '')) === 0) {
return k return k
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment