mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-16 09:50:45 +00:00
Merge pull request #827 from gzliudan/report_block
core: improve the output format of report block
This commit is contained in:
commit
b8f017a732
1 changed files with 7 additions and 11 deletions
|
|
@ -18,7 +18,6 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
@ -2587,9 +2586,6 @@ func (bc *BlockChain) addBadBlock(block *types.Block) {
|
||||||
func (bc *BlockChain) reportBlock(block *types.Block, receipts types.Receipts, err error) {
|
func (bc *BlockChain) reportBlock(block *types.Block, receipts types.Receipts, err error) {
|
||||||
bc.addBadBlock(block)
|
bc.addBadBlock(block)
|
||||||
|
|
||||||
// V2 specific logs
|
|
||||||
config, _ := json.Marshal(bc.chainConfig)
|
|
||||||
|
|
||||||
var roundNumber = types.Round(0)
|
var roundNumber = types.Round(0)
|
||||||
engine, ok := bc.Engine().(*XDPoS.XDPoS)
|
engine, ok := bc.Engine().(*XDPoS.XDPoS)
|
||||||
if ok {
|
if ok {
|
||||||
|
|
@ -2601,21 +2597,21 @@ func (bc *BlockChain) reportBlock(block *types.Block, receipts types.Receipts, e
|
||||||
}
|
}
|
||||||
|
|
||||||
var receiptString string
|
var receiptString string
|
||||||
for _, receipt := range receipts {
|
for i, receipt := range receipts {
|
||||||
receiptString += fmt.Sprintf("\t%v\n", receipt)
|
receiptString += fmt.Sprintf("\n %d: cumulative: %v gas: %v contract: %v status: %v tx: %v logs: %v bloom: %x state: %x",
|
||||||
|
i, receipt.CumulativeGasUsed, receipt.GasUsed, receipt.ContractAddress.Hex(),
|
||||||
|
receipt.Status, receipt.TxHash.Hex(), receipt.Logs, receipt.Bloom, receipt.PostState)
|
||||||
}
|
}
|
||||||
log.Error(fmt.Sprintf(`
|
log.Error(fmt.Sprintf(`
|
||||||
########## BAD BLOCK #########
|
########## BAD BLOCK #########
|
||||||
Chain config: %v
|
|
||||||
|
|
||||||
Number: %v
|
Number: %v
|
||||||
Hash: %#x
|
Hash: %#x
|
||||||
%v
|
|
||||||
|
|
||||||
Round: %v
|
Round: %v
|
||||||
Error: %v
|
Error: %v
|
||||||
|
Chain config: %v
|
||||||
|
Receipts: %v
|
||||||
##############################
|
##############################
|
||||||
`, string(config), block.Number(), block.Hash(), receiptString, roundNumber, err))
|
`, block.Number(), block.Hash(), roundNumber, err, bc.chainConfig, receiptString))
|
||||||
}
|
}
|
||||||
|
|
||||||
// InsertHeaderChain attempts to insert the given header chain in to the local
|
// InsertHeaderChain attempts to insert the given header chain in to the local
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue