aboutsummaryrefslogtreecommitdiffstats
path: root/les/peer.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-02-23 22:49:05 +0800
committerGitHub <noreply@github.com>2017-02-23 22:49:05 +0800
commit357732a8404c9fe4d02f041d20a0d05381a3e6d1 (patch)
treeedaf8a63eb7f7434cd9b9cbd764b3c4c3d76191e /les/peer.go
parent29fac7de448c85049a97cbec3dc0819122bd2cb0 (diff)
parentf89dd627760b43bd405cb3db1e5efdb100835db5 (diff)
downloadgo-tangerine-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar
go-tangerine-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.gz
go-tangerine-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.bz2
go-tangerine-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.lz
go-tangerine-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.xz
go-tangerine-357732a8404c9fe4d02f041d20a0d05381a3e6d1.tar.zst
go-tangerine-357732a8404c9fe4d02f041d20a0d05381a3e6d1.zip
Merge pull request #3696 from karalabe/contextual-logger
Contextual logger
Diffstat (limited to 'les/peer.go')
-rw-r--r--les/peer.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/les/peer.go b/les/peer.go
index d5008ded1..fc3591c78 100644
--- a/les/peer.go
+++ b/les/peer.go
@@ -27,8 +27,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/les/flowcontrol"
- "github.com/ethereum/go-ethereum/logger"
- "github.com/ethereum/go-ethereum/logger/glog"
+ "github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
)
@@ -196,51 +195,51 @@ func (p *peer) SendHeaderProofs(reqID, bv uint64, proofs []ChtResp) error {
// RequestHeadersByHash fetches a batch of blocks' headers corresponding to the
// specified header query, based on the hash of an origin block.
func (p *peer) RequestHeadersByHash(reqID, cost uint64, origin common.Hash, amount int, skip int, reverse bool) error {
- glog.V(logger.Debug).Infof("%v fetching %d headers from %x, skipping %d (reverse = %v)", p, amount, origin[:4], skip, reverse)
+ log.Debug(fmt.Sprintf("%v fetching %d headers from %x, skipping %d (reverse = %v)", p, amount, origin[:4], skip, reverse))
return sendRequest(p.rw, GetBlockHeadersMsg, reqID, cost, &getBlockHeadersData{Origin: hashOrNumber{Hash: origin}, Amount: uint64(amount), Skip: uint64(skip), Reverse: reverse})
}
// RequestHeadersByNumber fetches a batch of blocks' headers corresponding to the
// specified header query, based on the number of an origin block.
func (p *peer) RequestHeadersByNumber(reqID, cost, origin uint64, amount int, skip int, reverse bool) error {
- glog.V(logger.Debug).Infof("%v fetching %d headers from #%d, skipping %d (reverse = %v)", p, amount, origin, skip, reverse)
+ log.Debug(fmt.Sprintf("%v fetching %d headers from #%d, skipping %d (reverse = %v)", p, amount, origin, skip, reverse))
return sendRequest(p.rw, GetBlockHeadersMsg, reqID, cost, &getBlockHeadersData{Origin: hashOrNumber{Number: origin}, Amount: uint64(amount), Skip: uint64(skip), Reverse: reverse})
}
// RequestBodies fetches a batch of blocks' bodies corresponding to the hashes
// specified.
func (p *peer) RequestBodies(reqID, cost uint64, hashes []common.Hash) error {
- glog.V(logger.Debug).Infof("%v fetching %d block bodies", p, len(hashes))
+ log.Debug(fmt.Sprintf("%v fetching %d block bodies", p, len(hashes)))
return sendRequest(p.rw, GetBlockBodiesMsg, reqID, cost, hashes)
}
// RequestCode fetches a batch of arbitrary data from a node's known state
// data, corresponding to the specified hashes.
func (p *peer) RequestCode(reqID, cost uint64, reqs []*CodeReq) error {
- glog.V(logger.Debug).Infof("%v fetching %v state data", p, len(reqs))
+ log.Debug(fmt.Sprintf("%v fetching %v state data", p, len(reqs)))
return sendRequest(p.rw, GetCodeMsg, reqID, cost, reqs)
}
// RequestReceipts fetches a batch of transaction receipts from a remote node.
func (p *peer) RequestReceipts(reqID, cost uint64, hashes []common.Hash) error {
- glog.V(logger.Debug).Infof("%v fetching %v receipts", p, len(hashes))
+ log.Debug(fmt.Sprintf("%v fetching %v receipts", p, len(hashes)))
return sendRequest(p.rw, GetReceiptsMsg, reqID, cost, hashes)
}
// RequestProofs fetches a batch of merkle proofs from a remote node.
func (p *peer) RequestProofs(reqID, cost uint64, reqs []*ProofReq) error {
- glog.V(logger.Debug).Infof("%v fetching %v proofs", p, len(reqs))
+ log.Debug(fmt.Sprintf("%v fetching %v proofs", p, len(reqs)))
return sendRequest(p.rw, GetProofsMsg, reqID, cost, reqs)
}
// RequestHeaderProofs fetches a batch of header merkle proofs from a remote node.
func (p *peer) RequestHeaderProofs(reqID, cost uint64, reqs []*ChtReq) error {
- glog.V(logger.Debug).Infof("%v fetching %v header proofs", p, len(reqs))
+ log.Debug(fmt.Sprintf("%v fetching %v header proofs", p, len(reqs)))
return sendRequest(p.rw, GetHeaderProofsMsg, reqID, cost, reqs)
}
func (p *peer) SendTxs(cost uint64, txs types.Transactions) error {
- glog.V(logger.Debug).Infof("%v relaying %v txs", p, len(txs))
+ log.Debug(fmt.Sprintf("%v relaying %v txs", p, len(txs)))
reqID := getNextReqID()
p.fcServer.MustAssignRequest(reqID)
p.fcServer.SendRequest(reqID, cost)