aboutsummaryrefslogtreecommitdiffstats
path: root/ethpub
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-05 21:48:17 +0800
committerobscuren <geffobscura@gmail.com>2014-05-05 21:48:17 +0800
commit14a6e6a9cea48bcc7f6d5286e4f85b1a0cce84d8 (patch)
treedc6e553bf757863c68ed45087962e10d8012a56b /ethpub
parent3e5a7b34b111e5b72cd4878cdee42af956143406 (diff)
downloadgo-tangerine-14a6e6a9cea48bcc7f6d5286e4f85b1a0cce84d8.tar
go-tangerine-14a6e6a9cea48bcc7f6d5286e4f85b1a0cce84d8.tar.gz
go-tangerine-14a6e6a9cea48bcc7f6d5286e4f85b1a0cce84d8.tar.bz2
go-tangerine-14a6e6a9cea48bcc7f6d5286e4f85b1a0cce84d8.tar.lz
go-tangerine-14a6e6a9cea48bcc7f6d5286e4f85b1a0cce84d8.tar.xz
go-tangerine-14a6e6a9cea48bcc7f6d5286e4f85b1a0cce84d8.tar.zst
go-tangerine-14a6e6a9cea48bcc7f6d5286e4f85b1a0cce84d8.zip
Added the ability to submit byte code for contracts instead of Mutan code.
Diffstat (limited to 'ethpub')
-rw-r--r--ethpub/pub.go23
1 files changed, 17 insertions, 6 deletions
diff --git a/ethpub/pub.go b/ethpub/pub.go
index 431f173a0..4ec9877b2 100644
--- a/ethpub/pub.go
+++ b/ethpub/pub.go
@@ -103,13 +103,24 @@ func (lib *PEthereum) createTx(key, recipient, valueStr, gasStr, gasPriceStr, in
var tx *ethchain.Transaction
// Compile and assemble the given data
if contractCreation {
- initScript, err := ethutil.Compile(initStr)
- if err != nil {
- return nil, err
+ var initScript, mainScript []byte
+ var err error
+ if ethutil.IsHex(initStr) {
+ initScript = ethutil.FromHex(initStr)
+ } else {
+ initScript, err = ethutil.Compile(initStr[2:])
+ if err != nil {
+ return nil, err
+ }
}
- mainScript, err := ethutil.Compile(scriptStr)
- if err != nil {
- return nil, err
+
+ if ethutil.IsHex(scriptStr) {
+ mainScript = ethutil.FromHex(scriptStr[2:])
+ } else {
+ mainScript, err = ethutil.Compile(scriptStr)
+ if err != nil {
+ return nil, err
+ }
}
tx = ethchain.NewContractCreationTx(value, gas, gasPrice, mainScript, initScript)