diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-27 23:09:57 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-27 23:09:57 +0800 |
commit | 8a22cd5e6ca88eef0207cfb597175f720d6deda3 (patch) | |
tree | 909dcfe183df0e99b11f8eb1c72cc4c1253e9550 /core/vm/stack.go | |
parent | 00f8319faf95e53333a9573fdc9e49df23238607 (diff) | |
download | go-tangerine-8a22cd5e6ca88eef0207cfb597175f720d6deda3.tar go-tangerine-8a22cd5e6ca88eef0207cfb597175f720d6deda3.tar.gz go-tangerine-8a22cd5e6ca88eef0207cfb597175f720d6deda3.tar.bz2 go-tangerine-8a22cd5e6ca88eef0207cfb597175f720d6deda3.tar.lz go-tangerine-8a22cd5e6ca88eef0207cfb597175f720d6deda3.tar.xz go-tangerine-8a22cd5e6ca88eef0207cfb597175f720d6deda3.tar.zst go-tangerine-8a22cd5e6ca88eef0207cfb597175f720d6deda3.zip |
Removed defer/panic. #503
Diffstat (limited to 'core/vm/stack.go')
-rw-r--r-- | core/vm/stack.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/core/vm/stack.go b/core/vm/stack.go index 1e093476b..168637708 100644 --- a/core/vm/stack.go +++ b/core/vm/stack.go @@ -17,10 +17,7 @@ type stack struct { } func (st *stack) push(d *big.Int) { - if len(st.data) == maxStack { - panic(fmt.Sprintf("stack limit reached (%d)", maxStack)) - } - + // NOTE push limit (1024) is checked in baseCheck stackItem := new(big.Int).Set(d) if len(st.data) > st.ptr { st.data[st.ptr] = stackItem @@ -52,10 +49,11 @@ func (st *stack) peek() *big.Int { return st.data[st.len()-1] } -func (st *stack) require(n int) { +func (st *stack) require(n int) error { if st.len() < n { - panic(fmt.Sprintf("stack underflow (%d <=> %d)", len(st.data), n)) + return fmt.Errorf("stack underflow (%d <=> %d)", len(st.data), n) } + return nil } func (st *stack) Print() { |