aboutsummaryrefslogtreecommitdiffstats
path: root/vm/stack.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-31 18:12:40 +0800
committerobscuren <geffobscura@gmail.com>2014-12-31 18:12:40 +0800
commit4547a05a689e6a0f29dd2d90e840e84de7f564f4 (patch)
tree06cc11c1450005f21cc16f4182d94b7515ba74c5 /vm/stack.go
parent4b4e0821027cb5a82eaa04dcd89b1cad4a05af4e (diff)
downloadgo-tangerine-4547a05a689e6a0f29dd2d90e840e84de7f564f4.tar.gz
go-tangerine-4547a05a689e6a0f29dd2d90e840e84de7f564f4.tar.zst
go-tangerine-4547a05a689e6a0f29dd2d90e840e84de7f564f4.zip
Minor improvements
* Moved gas and mem size to its own function
Diffstat (limited to 'vm/stack.go')
-rw-r--r--vm/stack.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/vm/stack.go b/vm/stack.go
index 6091479cb..b9eaa10cd 100644
--- a/vm/stack.go
+++ b/vm/stack.go
@@ -91,6 +91,12 @@ func (st *Stack) Get(amount *big.Int) []*big.Int {
return nil
}
+func (st *Stack) require(n int) {
+ if st.Len() < n {
+ panic(fmt.Sprintf("stack underflow (%d <=> %d)", st.Len(), n))
+ }
+}
+
func (st *Stack) Print() {
fmt.Println("### stack ###")
if len(st.data) > 0 {