diff options
author | obscuren <geffobscura@gmail.com> | 2014-02-24 20:50:52 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-02-24 20:50:52 +0800 |
commit | 0afdedb01a8e4203129175dc9dcc213a55906a66 (patch) | |
tree | b21889533c19f3a01d26bcde5bb30f55ba9c108d /ethchain | |
parent | 6c7255cde2afdff7710af23c9830835398e6b43d (diff) | |
download | go-tangerine-0afdedb01a8e4203129175dc9dcc213a55906a66.tar go-tangerine-0afdedb01a8e4203129175dc9dcc213a55906a66.tar.gz go-tangerine-0afdedb01a8e4203129175dc9dcc213a55906a66.tar.bz2 go-tangerine-0afdedb01a8e4203129175dc9dcc213a55906a66.tar.lz go-tangerine-0afdedb01a8e4203129175dc9dcc213a55906a66.tar.xz go-tangerine-0afdedb01a8e4203129175dc9dcc213a55906a66.tar.zst go-tangerine-0afdedb01a8e4203129175dc9dcc213a55906a66.zip |
Some log statements changed to the default logger
Diffstat (limited to 'ethchain')
-rw-r--r-- | ethchain/block_manager.go | 25 | ||||
-rw-r--r-- | ethchain/vm.go | 10 |
2 files changed, 9 insertions, 26 deletions
diff --git a/ethchain/block_manager.go b/ethchain/block_manager.go index ad96f6a34..04036dbb1 100644 --- a/ethchain/block_manager.go +++ b/ethchain/block_manager.go @@ -165,37 +165,20 @@ func (bm *BlockManager) ProcessBlock(block *Block) error { if bm.CalculateTD(block) { // Sync the current block's state to the database and cancelling out the deferred Undo bm.bc.CurrentBlock.Sync() - // Add the block to the chain - bm.bc.Add(block) - - /* - ethutil.Config.Db.Put(block.Hash(), block.RlpEncode()) - bm.bc.CurrentBlock = block - bm.LastBlockHash = block.Hash() - bm.writeBlockInfo(block) - */ - - /* - txs := bm.TransactionPool.Flush() - var coded = []interface{}{} - for _, tx := range txs { - err := bm.TransactionPool.ValidateTransaction(tx) - if err == nil { - coded = append(coded, tx.RlpEncode()) - } - } - */ // Broadcast the valid block back to the wire //bm.Speaker.Broadcast(ethwire.MsgBlockTy, []interface{}{block.Value().Val}) + // Add the block to the chain + bm.bc.Add(block) + // If there's a block processor present, pass in the block for further // processing if bm.SecondaryBlockProcessor != nil { bm.SecondaryBlockProcessor.ProcessBlock(block) } - log.Printf("[BMGR] Added block #%d (%x)\n", block.BlockInfo().Number, block.Hash()) + ethutil.Config.Log.Infof("[BMGR] Added block #%d (%x)\n", block.BlockInfo().Number, block.Hash()) } else { fmt.Println("total diff failed") } diff --git a/ethchain/vm.go b/ethchain/vm.go index 9abd9cd41..c7a91a9c5 100644 --- a/ethchain/vm.go +++ b/ethchain/vm.go @@ -48,7 +48,7 @@ func (vm *Vm) Process(contract *Contract, state *State, vars RuntimeVars) { Pow256 := ethutil.BigPow(2, 256) if ethutil.Config.Debug { - fmt.Printf("# op\n") + ethutil.Config.Log.Debugf("# op\n") } stepcount := 0 @@ -98,7 +98,7 @@ out: totalFee.Add(totalFee, tf) if ethutil.Config.Debug { - fmt.Printf("%-3d %-4s", pc, op.String()) + ethutil.Config.Log.Debugf("%-3d %-4s", pc, op.String()) } switch op { @@ -385,12 +385,12 @@ out: // Delete the contract state.trie.Update(string(addr), "") - fmt.Printf("(%d) => %x\n", deletedMemory, recAddr) + ethutil.Config.Log.Debugf("(%d) => %x\n", deletedMemory, recAddr) break out default: fmt.Printf("Invalid OPCODE: %x\n", op) } - fmt.Println("") + ethutil.Config.Log.Debugln("") //vm.stack.Print() pc++ } @@ -399,7 +399,7 @@ out: } func makeInlineTx(addr []byte, value, from, length *big.Int, contract *Contract, state *State) { - fmt.Printf(" => creating inline tx %x %v %v %v", addr, value, from, length) + ethutil.Config.Log.Debugf(" => creating inline tx %x %v %v %v", addr, value, from, length) j := 0 dataItems := make([]string, int(length.Uint64())) for i := from.Uint64(); i < length.Uint64(); i++ { |