aboutsummaryrefslogtreecommitdiffstats
path: root/chain/state_transition.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-11-29 03:47:24 +0800
committerobscuren <geffobscura@gmail.com>2014-11-29 03:47:24 +0800
commit61556ef01de20a23951690376662ca58b345eca4 (patch)
tree005c5d54b48e637c4c4bb0ee8cfb5654559d6a3b /chain/state_transition.go
parent4cd9d57bad95a8c2266ed9d33e9723631da0626f (diff)
downloadgo-tangerine-61556ef01de20a23951690376662ca58b345eca4.tar
go-tangerine-61556ef01de20a23951690376662ca58b345eca4.tar.gz
go-tangerine-61556ef01de20a23951690376662ca58b345eca4.tar.bz2
go-tangerine-61556ef01de20a23951690376662ca58b345eca4.tar.lz
go-tangerine-61556ef01de20a23951690376662ca58b345eca4.tar.xz
go-tangerine-61556ef01de20a23951690376662ca58b345eca4.tar.zst
go-tangerine-61556ef01de20a23951690376662ca58b345eca4.zip
GasData changes & removed min gas price
Diffstat (limited to 'chain/state_transition.go')
-rw-r--r--chain/state_transition.go18
1 files changed, 15 insertions, 3 deletions
diff --git a/chain/state_transition.go b/chain/state_transition.go
index afe044299..f9b82c58b 100644
--- a/chain/state_transition.go
+++ b/chain/state_transition.go
@@ -156,12 +156,24 @@ func (self *StateTransition) TransitionState() (err error) {
}
// Pay data gas
- dataPrice := big.NewInt(int64(len(self.data)))
- dataPrice.Mul(dataPrice, vm.GasData)
- if err = self.UseGas(dataPrice); err != nil {
+ var dgas int64
+ for _, byt := range self.data {
+ if byt != 0 {
+ dgas += vm.GasData.Int64()
+ } else {
+ dgas += 1 // This is 1/5. If GasData changes this fails
+ }
+ }
+ if err = self.UseGas(big.NewInt(dgas)); err != nil {
return
}
+ //dataPrice := big.NewInt(int64(len(self.data)))
+ //dataPrice.Mul(dataPrice, vm.GasData)
+ //if err = self.UseGas(dataPrice); err != nil {
+ // return
+ //}
+
if sender.Balance().Cmp(self.value) < 0 {
return fmt.Errorf("Insufficient funds to transfer value. Req %v, has %v", self.value, sender.Balance)
}