fixCompareByteCode

pull/7/head
yann300 7 years ago
parent aff02b6779
commit c83833fca1
  1. 4
      src/helpers/util.js

@ -154,10 +154,14 @@ 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} code1 - 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} code2 - 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)
this will return false if the generated bytecode is empty (asbtract contract cannot be deployed)
* *
* @return {bool} * @return {bool}
*/ */
compareByteCode: function (code1, code2) { compareByteCode: function (code1, code2) {
if (code1 === code2) return true
if (code2 === '0x') return false // abstract contract. see comment
var pos = -1 var pos = -1
while ((pos = code2.search(/__(.*)__/)) !== -1) { while ((pos = code2.search(/__(.*)__/)) !== -1) {
code2 = replaceLibReference(code2, pos) code2 = replaceLibReference(code2, pos)

Loading…
Cancel
Save