diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-04 19:24:01 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-04 19:24:01 +0800 |
commit | 1889727144008273e9dcd491dce6672126c37652 (patch) | |
tree | c97f8939039377e10f695e554667945e36750b9a | |
parent | 218bfeb60e9a9e7f0874db18135e7ad633ff83f1 (diff) | |
download | dexon-1889727144008273e9dcd491dce6672126c37652.tar.gz dexon-1889727144008273e9dcd491dce6672126c37652.tar.zst dexon-1889727144008273e9dcd491dce6672126c37652.zip |
Moved logging to logger.Core
-rw-r--r-- | core/block_processor.go | 4 | ||||
-rw-r--r-- | core/state/state_object.go | 8 | ||||
-rw-r--r-- | core/state/statedb.go | 2 | ||||
-rw-r--r-- | core/state_transition.go | 7 | ||||
-rw-r--r-- | logger/verbosity.go | 1 | ||||
-rw-r--r-- | whisper/whisper.go | 2 |
6 files changed, 12 insertions, 12 deletions
diff --git a/core/block_processor.go b/core/block_processor.go index b3e18a70a..aad40291a 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -257,8 +257,8 @@ func (sm *BlockProcessor) ValidateHeader(block, parent *types.Header) error { return fmt.Errorf("GasLimit check failed for block %v (%v > %v)", block.GasLimit, a, b) } - // Allow future blocks up to 4 seconds - if int64(block.Time)+4 > time.Now().Unix() { + // Allow future blocks up to 10 seconds + if int64(block.Time)+10 > time.Now().Unix() { return BlockFutureErr } diff --git a/core/state/state_object.go b/core/state/state_object.go index e44bf2cd6..b8b1972e0 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -124,7 +124,7 @@ func (self *StateObject) MarkForDeletion() { self.remove = true self.dirty = true - if glog.V(logger.Debug) { + if glog.V(logger.Core) { glog.Infof("%x: #%d %v X\n", self.Address(), self.nonce, self.balance) } } @@ -190,7 +190,7 @@ func (c *StateObject) GetInstr(pc *big.Int) *common.Value { func (c *StateObject) AddBalance(amount *big.Int) { c.SetBalance(new(big.Int).Add(c.balance, amount)) - if glog.V(logger.Debug) { + if glog.V(logger.Core) { glog.Infof("%x: #%d %v (+ %v)\n", c.Address(), c.nonce, c.balance, amount) } } @@ -198,7 +198,7 @@ func (c *StateObject) AddBalance(amount *big.Int) { func (c *StateObject) SubBalance(amount *big.Int) { c.SetBalance(new(big.Int).Sub(c.balance, amount)) - if glog.V(logger.Debug) { + if glog.V(logger.Core) { glog.Infof("%x: #%d %v (- %v)\n", c.Address(), c.nonce, c.balance, amount) } } @@ -234,7 +234,7 @@ func (c *StateObject) ConvertGas(gas, price *big.Int) error { func (self *StateObject) SetGasPool(gasLimit *big.Int) { self.gasPool = new(big.Int).Set(gasLimit) - if glog.V(logger.Debug) { + if glog.V(logger.Core) { glog.Infof("%x: gas (+ %v)", self.Address(), self.gasPool) } } diff --git a/core/state/statedb.go b/core/state/statedb.go index e027533aa..065cbd607 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -209,7 +209,7 @@ func (self *StateDB) GetOrNewStateObject(addr common.Address) *StateObject { // NewStateObject create a state object whether it exist in the trie or not func (self *StateDB) newStateObject(addr common.Address) *StateObject { - if glog.V(logger.Debug) { + if glog.V(logger.Core) { glog.Infof("(+) %x\n", addr) } diff --git a/core/state_transition.go b/core/state_transition.go index 1994cabf6..e67abb951 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -8,6 +8,8 @@ import ( "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/params" ) @@ -166,9 +168,6 @@ func (self *StateTransition) preCheck() (err error) { } func (self *StateTransition) transitionState() (ret []byte, usedGas *big.Int, err error) { - // statelogger.Debugf("(~) %x\n", self.msg.Hash()) - - // XXX Transactions after this point are considered valid. if err = self.preCheck(); err != nil { return } @@ -207,7 +206,7 @@ func (self *StateTransition) transitionState() (ret []byte, usedGas *big.Int, er if err := self.UseGas(dataGas); err == nil { ref.SetCode(ret) } else { - statelogger.Infoln("Insufficient gas for creating code. Require", dataGas, "and have", self.gas) + glog.V(logger.Core).Infoln("Insufficient gas for creating code. Require", dataGas, "and have", self.gas) } } } else { diff --git a/logger/verbosity.go b/logger/verbosity.go index 16f60a100..59caa824e 100644 --- a/logger/verbosity.go +++ b/logger/verbosity.go @@ -3,6 +3,7 @@ package logger const ( Error = iota + 2 Info + Core Debug Detail ) diff --git a/whisper/whisper.go b/whisper/whisper.go index 1d019aea5..709667729 100644 --- a/whisper/whisper.go +++ b/whisper/whisper.go @@ -168,7 +168,7 @@ func (self *Whisper) msgHandler(peer *p2p.Peer, ws p2p.MsgReadWriter) error { for _, envelope := range envelopes { if err := self.add(envelope); err != nil { // TODO Punish peer here. Invalid envelope. - peer.Infoln(err) + peer.Debugln(err) } wpeer.addKnown(envelope) } |