aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/asm.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-10 08:04:06 +0800
committerobscuren <geffobscura@gmail.com>2014-05-10 08:04:06 +0800
commit3af35d922e5751dcf265d31abf293b759e570fec (patch)
tree5dbfdb50177d9c7ededabb240f7e792d1174505b /ethchain/asm.go
parent2096b3a9edb3289a8f30da81704181dec7b39917 (diff)
parentdbf8645aafb19837d01b939ba9b1d3e1a2fffbf9 (diff)
downloaddexon-3af35d922e5751dcf265d31abf293b759e570fec.tar
dexon-3af35d922e5751dcf265d31abf293b759e570fec.tar.gz
dexon-3af35d922e5751dcf265d31abf293b759e570fec.tar.bz2
dexon-3af35d922e5751dcf265d31abf293b759e570fec.tar.lz
dexon-3af35d922e5751dcf265d31abf293b759e570fec.tar.xz
dexon-3af35d922e5751dcf265d31abf293b759e570fec.tar.zst
dexon-3af35d922e5751dcf265d31abf293b759e570fec.zip
Merge branch 'release/poc5-rc2'
Diffstat (limited to 'ethchain/asm.go')
-rw-r--r--ethchain/asm.go21
1 files changed, 4 insertions, 17 deletions
diff --git a/ethchain/asm.go b/ethchain/asm.go
index 3194549ba..492be0999 100644
--- a/ethchain/asm.go
+++ b/ethchain/asm.go
@@ -21,9 +21,10 @@ func Disassemble(script []byte) (asm []string) {
asm = append(asm, fmt.Sprintf("%v", op))
switch op {
- case oPUSH: // Push PC+1 on to the stack
+ case oPUSH1, oPUSH2, oPUSH3, oPUSH4, oPUSH5, oPUSH6, oPUSH7, oPUSH8, oPUSH9, oPUSH10, oPUSH11, oPUSH12, oPUSH13, oPUSH14, oPUSH15, oPUSH16, oPUSH17, oPUSH18, oPUSH19, oPUSH20, oPUSH21, oPUSH22, oPUSH23, oPUSH24, oPUSH25, oPUSH26, oPUSH27, oPUSH28, oPUSH29, oPUSH30, oPUSH31, oPUSH32:
pc.Add(pc, ethutil.Big1)
- data := script[pc.Int64() : pc.Int64()+32]
+ a := int64(op) - int64(oPUSH1) + 1
+ data := script[pc.Int64() : pc.Int64()+a]
val := ethutil.BigD(data)
var b []byte
@@ -35,21 +36,7 @@ func Disassemble(script []byte) (asm []string) {
asm = append(asm, fmt.Sprintf("0x%x", b))
- pc.Add(pc, big.NewInt(31))
- case oPUSH20:
- pc.Add(pc, ethutil.Big1)
- data := script[pc.Int64() : pc.Int64()+20]
- val := ethutil.BigD(data)
- var b []byte
- if val.Int64() == 0 {
- b = []byte{0}
- } else {
- b = val.Bytes()
- }
-
- asm = append(asm, fmt.Sprintf("0x%x", b))
-
- pc.Add(pc, big.NewInt(19))
+ pc.Add(pc, big.NewInt(a-1))
}
pc.Add(pc, ethutil.Big1)