diff options
author | obscuren <geffobscura@gmail.com> | 2014-03-31 00:55:51 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-03-31 00:55:51 +0800 |
commit | 205e33bc831bb44f41dc899ae41bbfe0e44ddc5d (patch) | |
tree | ce6c3dcafa0d02417058fe5ea0a6091f16a90fc0 /ethchain/stack.go | |
parent | 6625b6ffbdb93a47de2187198d6e826fb32c1ba6 (diff) | |
download | dexon-205e33bc831bb44f41dc899ae41bbfe0e44ddc5d.tar dexon-205e33bc831bb44f41dc899ae41bbfe0e44ddc5d.tar.gz dexon-205e33bc831bb44f41dc899ae41bbfe0e44ddc5d.tar.bz2 dexon-205e33bc831bb44f41dc899ae41bbfe0e44ddc5d.tar.lz dexon-205e33bc831bb44f41dc899ae41bbfe0e44ddc5d.tar.xz dexon-205e33bc831bb44f41dc899ae41bbfe0e44ddc5d.tar.zst dexon-205e33bc831bb44f41dc899ae41bbfe0e44ddc5d.zip |
Fixed bug in stack to expand beyond expectations. Fixed EQ and NOT opcode
Diffstat (limited to 'ethchain/stack.go')
-rw-r--r-- | ethchain/stack.go | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/ethchain/stack.go b/ethchain/stack.go index 57165c432..e3fc4b684 100644 --- a/ethchain/stack.go +++ b/ethchain/stack.go @@ -173,21 +173,25 @@ func NewStack() *Stack { } func (st *Stack) Pop() *big.Int { - str := st.data[0] - st.data = st.data[1:] + str := st.data[len(st.data)-1] + + copy(st.data[:len(st.data)-1], st.data[:len(st.data)-1]) + st.data = st.data[:len(st.data)-1] return str } func (st *Stack) Popn() (*big.Int, *big.Int) { - ints := st.data[:2] - st.data = st.data[2:] + ints := st.data[len(st.data)-2:] + + copy(st.data[:len(st.data)-2], st.data[:len(st.data)-2]) + st.data = st.data[:len(st.data)-2] return ints[0], ints[1] } func (st *Stack) Peek() *big.Int { - str := st.data[0] + str := st.data[len(st.data)-1] return str } |