mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
feat: rename the receiver name of txSenderCacher
This commit is contained in:
parent
93c541ad56
commit
14ad8eb3a9
1 changed files with 7 additions and 7 deletions
|
|
@ -59,8 +59,8 @@ func newTxSenderCacher(threads int) *txSenderCacher {
|
||||||
|
|
||||||
// cache is an infinite loop, caching transaction senders from various forms of
|
// cache is an infinite loop, caching transaction senders from various forms of
|
||||||
// data structures.
|
// data structures.
|
||||||
func (cacher *txSenderCacher) cache() {
|
func (c *txSenderCacher) cache() {
|
||||||
for task := range cacher.tasks {
|
for task := range c.tasks {
|
||||||
for i := 0; i < len(task.txs); i += task.inc {
|
for i := 0; i < len(task.txs); i += task.inc {
|
||||||
types.Sender(task.signer, task.txs[i])
|
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
|
// 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
|
// 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.
|
// 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 there's nothing to recover, abort
|
||||||
if len(txs) == 0 {
|
if len(txs) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Ensure we have meaningful task sizes and schedule the recoveries
|
// Ensure we have meaningful task sizes and schedule the recoveries
|
||||||
tasks := cacher.threads
|
tasks := c.threads
|
||||||
if len(txs) < tasks*4 {
|
if len(txs) < tasks*4 {
|
||||||
tasks = (len(txs) + 3) / 4
|
tasks = (len(txs) + 3) / 4
|
||||||
}
|
}
|
||||||
for i := 0; i < tasks; i++ {
|
for i := 0; i < tasks; i++ {
|
||||||
cacher.tasks <- &txSenderCacherRequest{
|
c.tasks <- &txSenderCacherRequest{
|
||||||
signer: signer,
|
signer: signer,
|
||||||
txs: txs[i:],
|
txs: txs[i:],
|
||||||
inc: tasks,
|
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
|
// 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
|
// 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.
|
// 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
|
count := 0
|
||||||
for _, block := range blocks {
|
for _, block := range blocks {
|
||||||
count += len(block.Transactions())
|
count += len(block.Transactions())
|
||||||
|
|
@ -101,5 +101,5 @@ func (cacher *txSenderCacher) RecoverFromBlocks(signer types.Signer, blocks []*t
|
||||||
for _, block := range blocks {
|
for _, block := range blocks {
|
||||||
txs = append(txs, block.Transactions()...)
|
txs = append(txs, block.Transactions()...)
|
||||||
}
|
}
|
||||||
cacher.Recover(signer, txs)
|
c.Recover(signer, txs)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue