diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-03-04 00:53:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-04 00:53:30 +0800 |
commit | 07c216d603d7b366c177295761280acc706a9382 (patch) | |
tree | 8e46ff5081d126f6e99d5849cb7dad7f64aefdbd /light/txpool.go | |
parent | 1a00e39539f2bd7f59430062faa42bbc28cb89d2 (diff) | |
parent | e7030c4bf59e8e148822c50ae1a5896c604c38c1 (diff) | |
download | go-tangerine-07c216d603d7b366c177295761280acc706a9382.tar.gz go-tangerine-07c216d603d7b366c177295761280acc706a9382.tar.zst go-tangerine-07c216d603d7b366c177295761280acc706a9382.zip |
Merge pull request #3739 from karalabe/logger-updates-4
all: update light logs (and a few others) to the new model
Diffstat (limited to 'light/txpool.go')
-rw-r--r-- | light/txpool.go | 25 |
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) } |