mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
Rename errTxPoolTerminated and fix comment
This addresses some review feedback.
This commit is contained in:
parent
71d4441981
commit
45dce9d3e1
2 changed files with 6 additions and 6 deletions
|
|
@ -80,14 +80,14 @@ func (w *withdrawalQueue) subscribe(ch chan<- newWithdrawalsEvent) event.Subscri
|
||||||
return w.subs.Track(sub)
|
return w.subs.Track(sub)
|
||||||
}
|
}
|
||||||
|
|
||||||
// txPoolTerminatedError is returned when the txpool is already terminated when
|
// errTxPoolTerminated is returned when the txpool is already terminated when
|
||||||
// trying to seal a block.
|
// trying to seal a block.
|
||||||
type txPoolTerminatedError struct {
|
type errTxPoolTerminated struct {
|
||||||
error
|
error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error returns the message from the wrapped error.
|
// Error returns the message from the wrapped error.
|
||||||
func (t *txPoolTerminatedError) Error() string {
|
func (t *errTxPoolTerminated) Error() string {
|
||||||
return t.error.Error()
|
return t.error.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -192,7 +192,7 @@ func (c *SimulatedBeacon) sealBlock(withdrawals []*types.Withdrawal, timestamp u
|
||||||
// behavior, the pool will be explicitly blocked on its reset before
|
// behavior, the pool will be explicitly blocked on its reset before
|
||||||
// continuing to the block production below.
|
// continuing to the block production below.
|
||||||
if err := c.eth.APIBackend.TxPool().Sync(); err != nil {
|
if err := c.eth.APIBackend.TxPool().Sync(); err != nil {
|
||||||
return &txPoolTerminatedError{fmt.Errorf("failed to sync txpool: %w", err)}
|
return &errTxPoolTerminated{fmt.Errorf("failed to sync txpool: %w", err)}
|
||||||
}
|
}
|
||||||
|
|
||||||
version := payloadVersion(c.eth.BlockChain().Config(), timestamp)
|
version := payloadVersion(c.eth.BlockChain().Config(), timestamp)
|
||||||
|
|
@ -317,7 +317,7 @@ func (c *SimulatedBeacon) Commit() common.Hash {
|
||||||
return hash
|
return hash
|
||||||
}
|
}
|
||||||
|
|
||||||
// fallibleCommit attempts to seal a block on demand, but may return an error.
|
// commit attempts to seal a block on demand, but may return an error.
|
||||||
func (c *SimulatedBeacon) commit() (common.Hash, error) {
|
func (c *SimulatedBeacon) commit() (common.Hash, error) {
|
||||||
withdrawals := c.withdrawals.pop(10)
|
withdrawals := c.withdrawals.pop(10)
|
||||||
if err := c.sealBlock(withdrawals, uint64(time.Now().Unix())); err != nil {
|
if err := c.sealBlock(withdrawals, uint64(time.Now().Unix())); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ func (a *simulatedBeaconAPI) loop() {
|
||||||
}
|
}
|
||||||
// Avoids spinlooping if the txPool is alredy terminated.
|
// Avoids spinlooping if the txPool is alredy terminated.
|
||||||
if _, err := a.sim.commit(); err != nil {
|
if _, err := a.sim.commit(); err != nil {
|
||||||
var txpTermErr *txPoolTerminatedError
|
var txpTermErr *errTxPoolTerminated
|
||||||
if errors.As(err, &txpTermErr) {
|
if errors.As(err, &txpTermErr) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue