aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-16 17:51:16 +0800
committerobscuren <geffobscura@gmail.com>2014-06-16 17:51:16 +0800
commit48bca30e61f869a00111abe5d818ac7379854616 (patch)
tree6d74a838ae054a65f937f97c51f5780adae1642b
parent9f62d441a7c785b88f89d52643a9deaa822af15e (diff)
downloaddexon-48bca30e61f869a00111abe5d818ac7379854616.tar.gz
dexon-48bca30e61f869a00111abe5d818ac7379854616.tar.zst
dexon-48bca30e61f869a00111abe5d818ac7379854616.zip
Fixed minor issue with the gas pool
-rw-r--r--ethchain/state_manager.go2
-rw-r--r--ethchain/state_object.go4
-rw-r--r--ethchain/state_transition.go14
-rw-r--r--ethminer/miner.go2
4 files changed, 13 insertions, 9 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go
index 4b1b872cc..36bb14846 100644
--- a/ethchain/state_manager.go
+++ b/ethchain/state_manager.go
@@ -178,7 +178,7 @@ func (sm *StateManager) ProcessBlock(state *State, parent, block *Block, dontRea
fmt.Println(block.Receipts())
coinbase := state.GetOrNewStateObject(block.Coinbase)
- coinbase.gasPool = block.CalcGasLimit(parent)
+ coinbase.SetGasPool(block.CalcGasLimit(parent))
// Process the transactions on to current block
//sm.ApplyTransactions(block.Coinbase, state, parent, block.Transactions())
diff --git a/ethchain/state_object.go b/ethchain/state_object.go
index 03f4c9219..337c5a394 100644
--- a/ethchain/state_object.go
+++ b/ethchain/state_object.go
@@ -120,13 +120,13 @@ func (c *StateObject) ReturnGas(gas, price *big.Int, state *State) {
func (c *StateObject) AddAmount(amount *big.Int) {
c.SetAmount(new(big.Int).Add(c.Amount, amount))
- ethutil.Config.Log.Debugf("%x: #%d %v (+ %v)", c.Address(), c.Nonce, c.Amount, amount)
+ ethutil.Config.Log.Printf(ethutil.LogLevelSystem, "%x: #%d %v (+ %v)\n", c.Address(), c.Nonce, c.Amount, amount)
}
func (c *StateObject) SubAmount(amount *big.Int) {
c.SetAmount(new(big.Int).Sub(c.Amount, amount))
- ethutil.Config.Log.Debugf("%x: #%d %v (- %v)", c.Address(), c.Nonce, c.Amount, amount)
+ ethutil.Config.Log.Printf(ethutil.LogLevelSystem, "%x: #%d %v (- %v)\n", c.Address(), c.Nonce, c.Amount, amount)
}
func (c *StateObject) SetAmount(amount *big.Int) {
diff --git a/ethchain/state_transition.go b/ethchain/state_transition.go
index 76936aa7c..5beef61b4 100644
--- a/ethchain/state_transition.go
+++ b/ethchain/state_transition.go
@@ -113,12 +113,14 @@ func (self *StateTransition) BuyGas() error {
func (self *StateTransition) TransitionState() (err error) {
//snapshot := st.state.Snapshot()
- defer func() {
- if r := recover(); r != nil {
- ethutil.Config.Log.Infoln(r)
- err = fmt.Errorf("state transition err %v", r)
- }
- }()
+ /*
+ defer func() {
+ if r := recover(); r != nil {
+ ethutil.Config.Log.Infoln(r)
+ err = fmt.Errorf("state transition err %v", r)
+ }
+ }()
+ */
var (
tx = self.tx
diff --git a/ethminer/miner.go b/ethminer/miner.go
index 8ea6c51e5..1ef9ca229 100644
--- a/ethminer/miner.go
+++ b/ethminer/miner.go
@@ -139,7 +139,9 @@ func (self *Miner) mineNewBlock() {
// Accumulate all valid transaction and apply them to the new state
// Error may be ignored. It's not important during mining
+ parent := self.ethereum.BlockChain().GetBlock(self.block.PrevHash)
coinbase := self.block.State().GetOrNewStateObject(self.block.Coinbase)
+ coinbase.SetGasPool(self.block.CalcGasLimit(parent))
receipts, txs, unhandledTxs, err := stateManager.ProcessTransactions(coinbase, self.block.State(), self.block, self.block, self.txs)
if err != nil {
ethutil.Config.Log.Debugln("[MINER]", err)