aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/stack.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/vm/stack.go')
-rw-r--r--core/vm/stack.go10
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() {