diff options
author | obscuren <geffobscura@gmail.com> | 2014-04-23 17:50:38 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-04-23 17:50:38 +0800 |
commit | 61cd1594b52514244efcb47bd93722aaec0fe456 (patch) | |
tree | da026a70581a098254657a1c62dd2376fda1e424 /ethchain | |
parent | 11c26e32114dabc6524ad9fb1f868440f5d3fff3 (diff) | |
download | go-tangerine-61cd1594b52514244efcb47bd93722aaec0fe456.tar.gz go-tangerine-61cd1594b52514244efcb47bd93722aaec0fe456.tar.zst go-tangerine-61cd1594b52514244efcb47bd93722aaec0fe456.zip |
Fixed gas, price & value setters on initialization
Diffstat (limited to 'ethchain')
-rw-r--r-- | ethchain/closure.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ethchain/closure.go b/ethchain/closure.go index defd8b5c8..f8135c514 100644 --- a/ethchain/closure.go +++ b/ethchain/closure.go @@ -35,7 +35,15 @@ type Closure struct { // Create a new closure for the given data items func NewClosure(callee Callee, object Reference, script []byte, state *State, gas, price, val *big.Int) *Closure { - return &Closure{callee, object, script, state, gas, price, val, nil} + c := &Closure{callee: callee, object: object, Script: script, State: state, Args: nil} + + // In most cases gas, price and value are pointers to transaction objects + // and we don't want the transaction's values to change. + c.Gas = new(big.Int).Set(gas) + c.Price = new(big.Int).Set(price) + c.Value = new(big.Int).Set(val) + + return c } // Retuns the x element in data slice |