Commit f2072054 authored by yann300's avatar yann300

use compareByteCode in contractNameFromCode

parent acd644fd
...@@ -152,8 +152,8 @@ module.exports = { ...@@ -152,8 +152,8 @@ module.exports = {
/** /**
* Compare bytecode. return true if the code is equal (handle swarm hash and library references) * Compare bytecode. return true if the code is equal (handle swarm hash and library references)
* @param {String} code2 - the bytecode that is actually deployed (contains resolved library reference and a potentially different swarmhash) * @param {String} code1 - the bytecode that is actually deployed (contains resolved library reference and a potentially different swarmhash)
* @param {String} code1 - the bytecode generated by the compiler (contains unresolved library reference and a potentially different swarmhash) * @param {String} code2 - the bytecode generated by the compiler (contains unresolved library reference and a potentially different swarmhash)
* *
* @return {bool} * @return {bool}
*/ */
......
...@@ -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 (code.replace(util.swarmHashExtraction(), '').indexOf('0x' + contracts[k][byteProp].replace(util.swarmHashExtraction(), '')) === 0) { if (util.compareByteCode(code, '0x' + contracts[k][byteProp])) {
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