github.com/digdeepmining/go-atheios@v1.5.13-0.20180902133602-d5687a2e6f43/core/vm/stack_table.go (about) 1 package vm 2 3 import ( 4 "fmt" 5 6 "github.com/atheioschain/go-atheios/params" 7 ) 8 9 func makeStackFunc(pop, diff int) stackValidationFunc { 10 return func(stack *Stack) error { 11 if err := stack.require(pop); err != nil { 12 return err 13 } 14 15 if int64(stack.len()+diff) > params.StackLimit.Int64() { 16 return fmt.Errorf("stack limit reached %d (%d)", stack.len(), params.StackLimit) 17 } 18 return nil 19 } 20 } 21 22 func makeDupStackFunc(n int) stackValidationFunc { 23 return makeStackFunc(n, 1) 24 } 25 26 func makeSwapStackFunc(n int) stackValidationFunc { 27 return makeStackFunc(n, 0) 28 }