diff --git a/core/sender_cacher.go b/core/sender_cacher.go index 4be53619eb..37dc6f8f42 100644 --- a/core/sender_cacher.go +++ b/core/sender_cacher.go @@ -59,8 +59,8 @@ func newTxSenderCacher(threads int) *txSenderCacher { // cache is an infinite loop, caching transaction senders from various forms of // data structures. -func (cacher *txSenderCacher) cache() { - for task := range cacher.tasks { +func (c *txSenderCacher) cache() { + for task := range c.tasks { for i := 0; i < len(task.txs); i += task.inc { types.Sender(task.signer, task.txs[i]) } @@ -70,18 +70,18 @@ func (cacher *txSenderCacher) cache() { // Recover recovers the senders from a batch of transactions and caches them // back into the same data structures. There is no validation being done, nor // any reaction to invalid signatures. That is up to calling code later. -func (cacher *txSenderCacher) Recover(signer types.Signer, txs []*types.Transaction) { +func (c *txSenderCacher) Recover(signer types.Signer, txs []*types.Transaction) { // If there's nothing to recover, abort if len(txs) == 0 { return } // Ensure we have meaningful task sizes and schedule the recoveries - tasks := cacher.threads + tasks := c.threads if len(txs) < tasks*4 { tasks = (len(txs) + 3) / 4 } for i := 0; i < tasks; i++ { - cacher.tasks <- &txSenderCacherRequest{ + c.tasks <- &txSenderCacherRequest{ signer: signer, txs: txs[i:], inc: tasks, @@ -92,7 +92,7 @@ func (cacher *txSenderCacher) Recover(signer types.Signer, txs []*types.Transact // RecoverFromBlocks recovers the senders from a batch of blocks and caches them // back into the same data structures. There is no validation being done, nor // any reaction to invalid signatures. That is up to calling code later. -func (cacher *txSenderCacher) RecoverFromBlocks(signer types.Signer, blocks []*types.Block) { +func (c *txSenderCacher) RecoverFromBlocks(signer types.Signer, blocks []*types.Block) { count := 0 for _, block := range blocks { count += len(block.Transactions()) @@ -101,5 +101,5 @@ func (cacher *txSenderCacher) RecoverFromBlocks(signer types.Signer, blocks []*t for _, block := range blocks { txs = append(txs, block.Transactions()...) } - cacher.Recover(signer, txs) + c.Recover(signer, txs) }