diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-07-07 17:55:23 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2015-07-07 17:55:23 +0800 |
commit | 916d1554675974adb92af4046e1b04ad3b26dca3 (patch) | |
tree | 6ab24e55a8b4bd14b3a9c25917d440c03b875bfc /common/compiler | |
parent | d764bd058457cd9eb91d205d1ac187d40c4866d6 (diff) | |
parent | c5cb6e8e70339b6641b7ce46cda04b83936213b3 (diff) | |
download | dexon-916d1554675974adb92af4046e1b04ad3b26dca3.tar dexon-916d1554675974adb92af4046e1b04ad3b26dca3.tar.gz dexon-916d1554675974adb92af4046e1b04ad3b26dca3.tar.bz2 dexon-916d1554675974adb92af4046e1b04ad3b26dca3.tar.lz dexon-916d1554675974adb92af4046e1b04ad3b26dca3.tar.xz dexon-916d1554675974adb92af4046e1b04ad3b26dca3.tar.zst dexon-916d1554675974adb92af4046e1b04ad3b26dca3.zip |
Merge pull request #1429 from obscuren/rebase-registrar
Rebase registrar
Diffstat (limited to 'common/compiler')
-rw-r--r-- | common/compiler/solidity.go | 8 | ||||
-rw-r--r-- | common/compiler/solidity_test.go | 8 |
2 files changed, 6 insertions, 10 deletions
diff --git a/common/compiler/solidity.go b/common/compiler/solidity.go index caf86974e..4d5ffb473 100644 --- a/common/compiler/solidity.go +++ b/common/compiler/solidity.go @@ -185,12 +185,12 @@ func (sol *Solidity) Compile(source string) (contracts map[string]*Contract, err return } -func ExtractInfo(contract *Contract, filename string) (contenthash common.Hash, err error) { - contractInfo, err := json.Marshal(contract.Info) +func SaveInfo(info *ContractInfo, filename string) (contenthash common.Hash, err error) { + infojson, err := json.Marshal(info) if err != nil { return } - contenthash = common.BytesToHash(crypto.Sha3(contractInfo)) - err = ioutil.WriteFile(filename, contractInfo, 0600) + contenthash = common.BytesToHash(crypto.Sha3(infojson)) + err = ioutil.WriteFile(filename, infojson, 0600) return } diff --git a/common/compiler/solidity_test.go b/common/compiler/solidity_test.go index 59b6b6cd6..b493d6be3 100644 --- a/common/compiler/solidity_test.go +++ b/common/compiler/solidity_test.go @@ -72,19 +72,15 @@ func TestNoCompiler(t *testing.T) { } } -func TestExtractInfo(t *testing.T) { +func TestSaveInfo(t *testing.T) { var cinfo ContractInfo err := json.Unmarshal([]byte(info), &cinfo) if err != nil { t.Errorf("%v", err) } - contract := &Contract{ - Code: "", - Info: cinfo, - } filename := "/tmp/solctest.info.json" os.Remove(filename) - cinfohash, err := ExtractInfo(contract, filename) + cinfohash, err := SaveInfo(&cinfo, filename) if err != nil { t.Errorf("error extracting info: %v", err) } |