github.com/murrekatt/go-ethereum@v1.5.8-0.20170123175102-fc52f2c007fb/core/vm/stack_table.go (about)

     1  package vm
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/ethereum/go-ethereum/params"
     7  )
     8  
     9  func makeStackFunc(pop, push int) stackValidationFunc {
    10  	return func(stack *Stack) error {
    11  		if err := stack.require(pop); err != nil {
    12  			return err
    13  		}
    14  
    15  		if push > 0 && int64(stack.len()-pop+push) > params.StackLimit.Int64() {
    16  			return fmt.Errorf("stack limit reached %d (%d)", stack.len(), params.StackLimit.Int64())
    17  		}
    18  		return nil
    19  	}
    20  }