mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
all: use 0x-prefix string for type Address in log message (#1874)
This commit is contained in:
parent
d3b35cba42
commit
a83c43f240
12 changed files with 22 additions and 22 deletions
|
|
@ -316,7 +316,7 @@ func IsValidRelayer(statedb *state.StateDB, address common.Address) bool {
|
|||
return false
|
||||
}
|
||||
if IsResignedRelayer(address, statedb) {
|
||||
log.Debug("Relayer has resigned", "relayer", address.String())
|
||||
log.Debug("Relayer has resigned", "relayer", address)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ func AddTokenBalance(addr common.Address, value *big.Int, token common.Address,
|
|||
log.Debug("ApplyXDCXMatchedTransaction settle balance: ADD TOKEN XDC NATIVE BEFORE", "token", common.XDCNativeAddress, "address", addr, "balance", balance, "orderValue", value)
|
||||
statedb.AddBalance(addr, value, tracing.BalanceChangeUnspecified)
|
||||
balance = statedb.GetBalance(addr)
|
||||
log.Debug("ApplyXDCXMatchedTransaction settle balance: ADD XDC NATIVE BALANCE AFTER", "token", token.String(), "address", addr, "balance", balance, "orderValue", value)
|
||||
log.Debug("ApplyXDCXMatchedTransaction settle balance: ADD XDC NATIVE BALANCE AFTER", "token", token, "address", addr, "balance", balance, "orderValue", value)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ func SubTokenBalance(addr common.Address, value *big.Int, token common.Address,
|
|||
}
|
||||
statedb.SubBalance(addr, value, tracing.BalanceChangeUnspecified)
|
||||
balance = statedb.GetBalance(addr)
|
||||
log.Debug("ApplyXDCXMatchedTransaction settle balance: SUB XDC NATIVE BALANCE AFTER", "token", token.String(), "address", addr, "balance", balance, "orderValue", value)
|
||||
log.Debug("ApplyXDCXMatchedTransaction settle balance: SUB XDC NATIVE BALANCE AFTER", "token", token, "address", addr, "balance", balance, "orderValue", value)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -204,13 +204,13 @@ func SubTokenBalance(addr common.Address, value *big.Int, token common.Address,
|
|||
slot := TokenMappingSlot["balances"]
|
||||
locHash := common.BigToHash(GetLocMappingAtKey(addr.Hash(), slot))
|
||||
balance := statedb.GetState(token, locHash).Big()
|
||||
log.Debug("ApplyXDCXMatchedTransaction settle balance: SUB TOKEN BALANCE BEFORE", "token", token.String(), "address", addr, "balance", balance, "orderValue", value)
|
||||
log.Debug("ApplyXDCXMatchedTransaction settle balance: SUB TOKEN BALANCE BEFORE", "token", token, "address", addr, "balance", balance, "orderValue", value)
|
||||
if balance.Cmp(value) < 0 {
|
||||
return errors.Errorf("value %s in token %s not enough , have : %s , want : %s ", addr.String(), token.String(), balance, value)
|
||||
}
|
||||
balance = new(big.Int).Sub(balance, value)
|
||||
statedb.SetState(token, locHash, common.BigToHash(balance))
|
||||
log.Debug("ApplyXDCXMatchedTransaction settle balance: SUB TOKEN BALANCE AFTER", "token", token.String(), "address", addr, "balance", balance, "orderValue", value)
|
||||
log.Debug("ApplyXDCXMatchedTransaction settle balance: SUB TOKEN BALANCE AFTER", "token", token, "address", addr, "balance", balance, "orderValue", value)
|
||||
return nil
|
||||
} else {
|
||||
return errors.Errorf("token %s isn't exist", token.String())
|
||||
|
|
@ -230,7 +230,7 @@ func CheckSubTokenBalance(addr common.Address, value *big.Int, token common.Addr
|
|||
return nil, errors.Errorf("value %s in token %s not enough , have : %s , want : %s ", addr.String(), token.String(), balance, value)
|
||||
}
|
||||
newBalance := new(big.Int).Sub(balance, value)
|
||||
log.Debug("CheckSubTokenBalance settle balance: SUB XDC NATIVE BALANCE ", "token", token, "address", addr.String(), "balance", balance, "value", value, "newBalance", newBalance)
|
||||
log.Debug("CheckSubTokenBalance settle balance: SUB XDC NATIVE BALANCE ", "token", token, "address", addr, "balance", balance, "value", value, "newBalance", newBalance)
|
||||
return newBalance, nil
|
||||
}
|
||||
// TRC tokens
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ func initGenesis(ctx *cli.Context) error {
|
|||
utils.Fatalf("Failed to write genesis block: %v", err)
|
||||
}
|
||||
chaindb.Close()
|
||||
log.Info("Successfully wrote genesis state", "database", name, "hash", hash.String())
|
||||
log.Info("Successfully wrote genesis state", "database", name, "hash", hash)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ func (w *wizard) makeGenesis() {
|
|||
storage := make(map[common.Hash]common.Hash)
|
||||
f := func(key, val common.Hash) bool {
|
||||
storage[key] = common.BytesToHash(val.Bytes())
|
||||
log.Info("DecodeBytes", "value", val.String(), "decode", storage[key].String())
|
||||
log.Info("DecodeBytes", "value", val, "decode", storage[key])
|
||||
return true
|
||||
}
|
||||
contractBackend.ForEachStorageAt(ctx, validatorAddress, nil, f)
|
||||
|
|
|
|||
|
|
@ -916,13 +916,13 @@ func setWhiteBlackListPeers(ctx *cli.Context, cfg *p2p.Config) {
|
|||
node1, err1 := discover.HexID(url)
|
||||
if err1 == nil {
|
||||
cfg.WhitePeers[node1] = struct{}{}
|
||||
log.Info("Add peer to whitelist", "id", node1.String())
|
||||
log.Info("Add peer to whitelist", "id", node1)
|
||||
continue
|
||||
}
|
||||
node2, err2 := discover.ParseNode(url)
|
||||
if err2 == nil {
|
||||
cfg.WhitePeers[node2.ID] = struct{}{}
|
||||
log.Info("Add peer to whitelist", "enode", url, "id", node2.ID.String())
|
||||
log.Info("Add peer to whitelist", "enode", url, "id", node2.ID)
|
||||
continue
|
||||
}
|
||||
log.Crit("Invalid peer id for whitelist", "url", url, "err1", err1, "err2", err2)
|
||||
|
|
@ -939,13 +939,13 @@ func setWhiteBlackListPeers(ctx *cli.Context, cfg *p2p.Config) {
|
|||
node1, err1 := discover.HexID(url)
|
||||
if err1 == nil {
|
||||
cfg.BlackPeers[node1] = struct{}{}
|
||||
log.Info("Add peer to blacklsit", "id", node1.String())
|
||||
log.Info("Add peer to blacklist", "id", node1)
|
||||
continue
|
||||
}
|
||||
node2, err2 := discover.ParseNode(url)
|
||||
if err2 == nil {
|
||||
cfg.BlackPeers[node2.ID] = struct{}{}
|
||||
log.Info("Add peer to blacklsit", "enode", url, "id", node2.ID.String())
|
||||
log.Info("Add peer to blacklist", "enode", url, "id", node2.ID)
|
||||
continue
|
||||
}
|
||||
log.Crit("Invalid peer id for blacklist", "url", url, "err1", err1, "err2", err2)
|
||||
|
|
@ -963,7 +963,7 @@ func removeBlackPeers(cfg *p2p.Config) {
|
|||
filteredNodes := make([]*discover.Node, 0, len(cfg.BootstrapNodes))
|
||||
for _, node := range cfg.BootstrapNodes {
|
||||
if _, ok := cfg.BlackPeers[node.ID]; ok {
|
||||
log.Info("Remove black peer", "enode", node.String(), "id", node.ID)
|
||||
log.Info("Remove black peer", "enode", node, "id", node.ID)
|
||||
continue
|
||||
}
|
||||
filteredNodes = append(filteredNodes, node)
|
||||
|
|
@ -1363,7 +1363,7 @@ func setSmartCard(ctx *cli.Context, cfg *node.Config) {
|
|||
return
|
||||
}
|
||||
if fi.Mode()&os.ModeType != os.ModeSocket {
|
||||
log.Error("Invalid smartcard daemon path", "path", path, "type", fi.Mode().String())
|
||||
log.Error("Invalid smartcard daemon path", "path", path, "type", fi.Mode())
|
||||
return
|
||||
}
|
||||
// Smartcard daemon path exists and is a socket, enable it
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ func (x *XDPoS) CacheNoneTIPSigningTxs(header *types.Header, txs []*types.Transa
|
|||
}
|
||||
}
|
||||
|
||||
log.Debug("Save tx signers to cache", "hash", header.Hash().String(), "number", header.Number, "len(txs)", len(signTxs))
|
||||
log.Debug("Save tx signers to cache", "hash", header.Hash(), "number", header.Number, "len(txs)", len(signTxs))
|
||||
x.signingTxsCache.Add(header.Hash(), signTxs)
|
||||
|
||||
return signTxs
|
||||
|
|
@ -545,7 +545,7 @@ func (x *XDPoS) CacheSigningTxs(hash common.Hash, txs []*types.Transaction) []*t
|
|||
signTxs = append(signTxs, tx)
|
||||
}
|
||||
}
|
||||
log.Debug("Save tx signers to cache", "hash", hash.String(), "len(txs)", len(signTxs))
|
||||
log.Debug("Save tx signers to cache", "hash", hash, "len(txs)", len(signTxs))
|
||||
x.signingTxsCache.Add(hash, signTxs)
|
||||
return signTxs
|
||||
}
|
||||
|
|
|
|||
|
|
@ -913,7 +913,7 @@ func (x *XDPoS_v1) Seal(chain consensus.ChainReader, block *types.Block, stop <-
|
|||
if limit := uint64(2); number < limit || seen > number-limit {
|
||||
// Only take into account the non-epoch blocks
|
||||
if number%x.config.Epoch != 0 {
|
||||
log.Info("Signed recently, must wait for others ", "len(masternodes)", len(masternodes), "number", number, "limit", limit, "seen", seen, "recent", recent.String(), "snap.Recents", snap.Recents)
|
||||
log.Info("Signed recently, must wait for others ", "len(masternodes)", len(masternodes), "number", number, "limit", limit, "seen", seen, "recent", recent, "snap.Recents", snap.Recents)
|
||||
<-stop
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ func GetRewardForCheckpoint(c *XDPoS.XDPoS, chain consensus.ChainReader, header
|
|||
mapBlkHash[i] = header.Hash()
|
||||
signingTxs, ok := c.GetCachedSigningTxs(header.Hash())
|
||||
if !ok {
|
||||
log.Debug("Failed get from cached", "hash", header.Hash().String(), "number", i)
|
||||
log.Debug("Failed get from cached", "hash", header.Hash(), "number", i)
|
||||
block := chain.GetBlock(header.Hash(), i)
|
||||
txs := block.Transactions()
|
||||
if !chain.Config().IsTIPSigning(header.Number) {
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ func GetSigningTxCount(c *XDPoS.XDPoS, chain consensus.ChainReader, header *type
|
|||
mapBlkHash[i] = h.Hash()
|
||||
signingTxs, ok := c.GetCachedSigningTxs(h.Hash())
|
||||
if !ok {
|
||||
log.Debug("Failed get from cached", "hash", h.Hash().String(), "number", i)
|
||||
log.Debug("Failed get from cached", "hash", h.Hash(), "number", i)
|
||||
block := chain.GetBlock(h.Hash(), i)
|
||||
if block != nil {
|
||||
txs := block.Transactions()
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ func RunGit(args ...string) string {
|
|||
}
|
||||
return ""
|
||||
}
|
||||
log.Fatal(strings.Join(cmd.Args, " "), ": ", err, "\n", stderr.String())
|
||||
log.Fatal(strings.Join(cmd.Args, " "), ": ", err, "\n", stderr)
|
||||
}
|
||||
return strings.TrimSpace(stdout.String())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ func TestJSONHandler(t *testing.T) {
|
|||
logger = slog.New(handler)
|
||||
logger.Debug("hi there")
|
||||
if len(out.String()) != 0 {
|
||||
t.Errorf("expected empty debug log output, but got: %v", out.String())
|
||||
t.Errorf("expected empty debug log output, but got: %v", out)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ func (sa *SimAdapter) NewNode(config *NodeConfig) (Node, error) {
|
|||
Dialer: sa,
|
||||
EnableMsgEvents: true,
|
||||
},
|
||||
Logger: log.New("node.id", id.String()),
|
||||
Logger: log.New("node.id", id),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
Loading…
Reference in a new issue