aboutsummaryrefslogtreecommitdiffstats
path: root/light/txpool.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-03-03 17:41:52 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-03-03 17:41:52 +0800
commite7030c4bf59e8e148822c50ae1a5896c604c38c1 (patch)
tree4403290e84761608e8437d23ecef4d934406dd46 /light/txpool.go
parentfaf713632c307e3fd77a492481846b858ad991f9 (diff)
downloaddexon-e7030c4bf59e8e148822c50ae1a5896c604c38c1.tar
dexon-e7030c4bf59e8e148822c50ae1a5896c604c38c1.tar.gz
dexon-e7030c4bf59e8e148822c50ae1a5896c604c38c1.tar.bz2
dexon-e7030c4bf59e8e148822c50ae1a5896c604c38c1.tar.lz
dexon-e7030c4bf59e8e148822c50ae1a5896c604c38c1.tar.xz
dexon-e7030c4bf59e8e148822c50ae1a5896c604c38c1.tar.zst
dexon-e7030c4bf59e8e148822c50ae1a5896c604c38c1.zip
all: update light logs (and a few others) to the new model
Diffstat (limited to 'light/txpool.go')
-rw-r--r--light/txpool.go25
1 files changed, 4 insertions, 21 deletions
diff --git a/light/txpool.go b/light/txpool.go
index ecd6cfa26..28c8d8ca5 100644
--- a/light/txpool.go
+++ b/light/txpool.go
@@ -320,7 +320,7 @@ func (pool *TxPool) eventLoop() {
func (pool *TxPool) Stop() {
close(pool.quit)
pool.events.Unsubscribe()
- log.Info(fmt.Sprint("Transaction pool stopped"))
+ log.Info("Transaction pool stopped")
}
// Stats returns the number of currently pending (locally created) transactions
@@ -416,20 +416,8 @@ func (self *TxPool) add(ctx context.Context, tx *types.Transaction) error {
go self.eventMux.Post(core.TxPreEvent{Tx: tx})
}
- log.Debug("", "msg", log.Lazy{Fn: func() string {
- var toname string
- if to := tx.To(); to != nil {
- toname = common.Bytes2Hex(to[:4])
- } else {
- toname = "[NEW_CONTRACT]"
- }
- // we can ignore the error here because From is
- // verified in ValidateTransaction.
- f, _ := types.Sender(self.signer, tx)
- from := common.Bytes2Hex(f[:4])
- return fmt.Sprintf("(t) %x => %s (%v) %x\n", from, toname, tx.Value(), hash)
- }})
-
+ // Print a log message if low enough level is set
+ log.Debug("Pooled new transaction", "hash", hash, "from", log.Lazy{Fn: func() common.Address { from, _ := types.Sender(self.signer, tx); return from }}, "to", tx.To())
return nil
}
@@ -462,15 +450,10 @@ func (self *TxPool) AddBatch(ctx context.Context, txs []*types.Transaction) {
var sendTx types.Transactions
for _, tx := range txs {
- if err := self.add(ctx, tx); err != nil {
- log.Debug(fmt.Sprint("tx error:", err))
- } else {
+ if err := self.add(ctx, tx); err == nil {
sendTx = append(sendTx, tx)
- h := tx.Hash()
- log.Debug(fmt.Sprintf("tx %x\n", h[:4]))
}
}
-
if len(sendTx) > 0 {
self.relay.Send(sendTx)
}