aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-02-28 19:35:17 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-02-28 21:03:20 +0800
commite588e0ca2b3b615af0ecfd5679c42df8f1cc4272 (patch)
treec37e95792ed9f17209b7de26a5d6047ac915db2a /accounts
parentd4f60d362b8fcf82db1accf89c146a2a71375841 (diff)
downloadgo-tangerine-e588e0ca2b3b615af0ecfd5679c42df8f1cc4272.tar.gz
go-tangerine-e588e0ca2b3b615af0ecfd5679c42df8f1cc4272.tar.zst
go-tangerine-e588e0ca2b3b615af0ecfd5679c42df8f1cc4272.zip
all: next batch of log polishes to contextual versions
Diffstat (limited to 'accounts')
-rw-r--r--accounts/abi/bind/util.go2
-rw-r--r--accounts/keystore/account_cache.go2
-rw-r--r--accounts/usbwallet/ledger_hub.go2
-rw-r--r--accounts/usbwallet/ledger_wallet.go26
4 files changed, 16 insertions, 16 deletions
diff --git a/accounts/abi/bind/util.go b/accounts/abi/bind/util.go
index 50b7a6f02..8348f6980 100644
--- a/accounts/abi/bind/util.go
+++ b/accounts/abi/bind/util.go
@@ -32,7 +32,7 @@ func WaitMined(ctx context.Context, b DeployBackend, tx *types.Transaction) (*ty
queryTicker := time.NewTicker(time.Second)
defer queryTicker.Stop()
- logger := log.New("hash", tx.Hash().Hex()[:8])
+ logger := log.New("hash", tx.Hash())
for {
receipt, err := b.TransactionReceipt(ctx, tx.Hash())
if receipt != nil {
diff --git a/accounts/keystore/account_cache.go b/accounts/keystore/account_cache.go
index 2324e128d..fb4086c3a 100644
--- a/accounts/keystore/account_cache.go
+++ b/accounts/keystore/account_cache.go
@@ -262,7 +262,7 @@ func (ac *accountCache) scan() ([]accounts.Account, error) {
case err != nil:
logger.Debug("Failed to decode keystore key", "err", err)
case (addr == common.Address{}):
- logger.Debug("Failed to decode keystore key", "error", "missing or zero address")
+ logger.Debug("Failed to decode keystore key", "err", "missing or zero address")
default:
addrs = append(addrs, accounts.Account{Address: addr, URL: accounts.URL{Scheme: KeyStoreScheme, Path: path}})
}
diff --git a/accounts/usbwallet/ledger_hub.go b/accounts/usbwallet/ledger_hub.go
index d1aeed748..db874f4cc 100644
--- a/accounts/usbwallet/ledger_hub.go
+++ b/accounts/usbwallet/ledger_hub.go
@@ -121,7 +121,7 @@ func (hub *LedgerHub) refreshWallets() {
}
// If there are no more wallets or the device is before the next, wrap new wallet
if len(hub.wallets) == 0 || hub.wallets[0].URL().Cmp(url) > 0 {
- wallet := &ledgerWallet{url: &url, info: ledger, logger: log.New("url", url)}
+ wallet := &ledgerWallet{url: &url, info: ledger, log: log.New("url", url)}
events = append(events, accounts.WalletEvent{Wallet: wallet, Arrive: true})
wallets = append(wallets, wallet)
diff --git a/accounts/usbwallet/ledger_wallet.go b/accounts/usbwallet/ledger_wallet.go
index 37e04e598..7952ab526 100644
--- a/accounts/usbwallet/ledger_wallet.go
+++ b/accounts/usbwallet/ledger_wallet.go
@@ -124,7 +124,7 @@ type ledgerWallet struct {
commsLock chan struct{} // Mutex (buf=1) for the USB comms without keeping the state locked
stateLock sync.RWMutex // Protects read and write access to the wallet struct fields
- logger log.Logger // Contextual logger to tag the ledger with its id
+ log log.Logger // Contextual logger to tag the ledger with its id
}
// URL implements accounts.Wallet, returning the URL of the Ledger device.
@@ -222,8 +222,8 @@ func (w *ledgerWallet) Open(passphrase string) error {
// - libusb on Windows doesn't support hotplug, so we can't detect USB unplugs
// - communication timeout on the Ledger requires a device power cycle to fix
func (w *ledgerWallet) heartbeat() {
- w.logger.Debug("Ledger health-check started")
- defer w.logger.Debug("Ledger health-check stopped")
+ w.log.Debug("Ledger health-check started")
+ defer w.log.Debug("Ledger health-check stopped")
// Execute heartbeat checks until termination or error
var (
@@ -262,7 +262,7 @@ func (w *ledgerWallet) heartbeat() {
}
// In case of error, wait for termination
if err != nil {
- w.logger.Debug("Ledger health-check failed", "err", err)
+ w.log.Debug("Ledger health-check failed", "err", err)
errc = <-w.healthQuit
}
errc <- err
@@ -350,8 +350,8 @@ func (w *ledgerWallet) Accounts() []accounts.Account {
// selfDerive is an account derivation loop that upon request attempts to find
// new non-zero accounts.
func (w *ledgerWallet) selfDerive() {
- w.logger.Debug("Ledger self-derivation started")
- defer w.logger.Debug("Ledger self-derivation stopped")
+ w.log.Debug("Ledger self-derivation started")
+ defer w.log.Debug("Ledger self-derivation stopped")
// Execute self-derivations until termination or error
var (
@@ -396,7 +396,7 @@ func (w *ledgerWallet) selfDerive() {
// Retrieve the next derived Ethereum account
if nextAddr == (common.Address{}) {
if nextAddr, err = w.ledgerDerive(nextPath); err != nil {
- w.logger.Warn("Ledger account derivation failed", "err", err)
+ w.log.Warn("Ledger account derivation failed", "err", err)
break
}
}
@@ -407,12 +407,12 @@ func (w *ledgerWallet) selfDerive() {
)
balance, err = w.deriveChain.BalanceAt(context, nextAddr, nil)
if err != nil {
- w.logger.Warn("Ledger balance retrieval failed", "err", err)
+ w.log.Warn("Ledger balance retrieval failed", "err", err)
break
}
nonce, err = w.deriveChain.NonceAt(context, nextAddr, nil)
if err != nil {
- w.logger.Warn("Ledger nonce retrieval failed", "err", err)
+ w.log.Warn("Ledger nonce retrieval failed", "err", err)
break
}
// If the next account is empty, stop self-derivation, but add it nonetheless
@@ -432,7 +432,7 @@ func (w *ledgerWallet) selfDerive() {
// Display a log message to the user for new (or previously empty accounts)
if _, known := w.paths[nextAddr]; !known || (!empty && nextAddr == w.deriveNextAddr) {
- w.logger.Info("Ledger discovered new account", "address", nextAddr.Hex(), "path", path, "balance", balance, "nonce", nonce)
+ w.log.Info("Ledger discovered new account", "address", nextAddr, "path", path, "balance", balance, "nonce", nonce)
}
// Fetch the next potential account
if !empty {
@@ -471,7 +471,7 @@ func (w *ledgerWallet) selfDerive() {
}
// In case of error, wait for termination
if err != nil {
- w.logger.Debug("Ledger self-derivation failed", "err", err)
+ w.log.Debug("Ledger self-derivation failed", "err", err)
errc = <-w.deriveQuit
}
errc <- err
@@ -851,7 +851,7 @@ func (w *ledgerWallet) ledgerExchange(opcode ledgerOpcode, p1 ledgerParam1, p2 l
apdu = nil
}
// Send over to the device
- w.logger.Trace("Data chunk sent to the Ledger", "chunk", hexutil.Bytes(chunk))
+ w.log.Trace("Data chunk sent to the Ledger", "chunk", hexutil.Bytes(chunk))
if _, err := w.device.Write(chunk); err != nil {
return nil, err
}
@@ -864,7 +864,7 @@ func (w *ledgerWallet) ledgerExchange(opcode ledgerOpcode, p1 ledgerParam1, p2 l
if _, err := io.ReadFull(w.device, chunk); err != nil {
return nil, err
}
- w.logger.Trace("Data chunk received from the Ledger", "chunk", hexutil.Bytes(chunk))
+ w.log.Trace("Data chunk received from the Ledger", "chunk", hexutil.Bytes(chunk))
// Make sure the transport header matches
if chunk[0] != 0x01 || chunk[1] != 0x01 || chunk[2] != 0x05 {