mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
eth/handler: simplify code
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
d220e4c844
commit
1559979671
1 changed files with 4 additions and 10 deletions
|
|
@ -179,18 +179,12 @@ func newHandler(config *handlerConfig) (*handler, error) {
|
|||
addTxs := func(txs []*types.Transaction) []error {
|
||||
return h.txpool.Add(txs, false)
|
||||
}
|
||||
hasTx := func(hash common.Hash) bool {
|
||||
return h.txpool.Has(hash)
|
||||
}
|
||||
chainTx := func(hash common.Hash) bool {
|
||||
// check on chain (no need to check limbo separately, as chain checks limbo too)
|
||||
return h.chain.HasCanonicalTransaction(hash, true)
|
||||
}
|
||||
validateMeta := func(tx common.Hash, kind byte) error {
|
||||
if hasTx(tx) {
|
||||
validateMeta := func(hash common.Hash, kind byte) error {
|
||||
if h.txpool.Has(hash) {
|
||||
return txpool.ErrAlreadyKnown
|
||||
}
|
||||
if chainTx(tx) {
|
||||
// check on chain as well (no need to check limbo separately, as chain checks limbo too)
|
||||
if h.chain.HasCanonicalTransaction(hash, true) {
|
||||
return txpool.ErrAlreadyKnown
|
||||
}
|
||||
if !h.txpool.FilterType(kind) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue