mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-15 08:23:46 +00:00
Merge branch 'ethereum:master' into gethintegration
This commit is contained in:
commit
dc433b38e4
2 changed files with 11 additions and 2 deletions
|
|
@ -179,10 +179,19 @@ func (db *CachingDB) Reader(stateRoot common.Hash) (Reader, error) {
|
||||||
// is optional and may be partially useful if it's not fully
|
// is optional and may be partially useful if it's not fully
|
||||||
// generated.
|
// generated.
|
||||||
if db.snap != nil {
|
if db.snap != nil {
|
||||||
|
// If standalone state snapshot is available (hash scheme),
|
||||||
|
// then construct the legacy snap reader.
|
||||||
snap := db.snap.Snapshot(stateRoot)
|
snap := db.snap.Snapshot(stateRoot)
|
||||||
if snap != nil {
|
if snap != nil {
|
||||||
readers = append(readers, newFlatReader(snap))
|
readers = append(readers, newFlatReader(snap))
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// If standalone state snapshot is not available, try to construct
|
||||||
|
// the state reader with database.
|
||||||
|
reader, err := db.triedb.StateReader(stateRoot)
|
||||||
|
if err == nil {
|
||||||
|
readers = append(readers, newFlatReader(reader)) // state reader is optional
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Set up the trie reader, which is expected to always be available
|
// Set up the trie reader, which is expected to always be available
|
||||||
// as the gatekeeper unless the state is corrupted.
|
// as the gatekeeper unless the state is corrupted.
|
||||||
|
|
|
||||||
|
|
@ -626,7 +626,7 @@ func (pool *LegacyPool) validateTxBasics(tx *types.Transaction, local bool) erro
|
||||||
|
|
||||||
// validateTx checks whether a transaction is valid according to the consensus
|
// validateTx checks whether a transaction is valid according to the consensus
|
||||||
// rules and adheres to some heuristic limits of the local node (price and size).
|
// rules and adheres to some heuristic limits of the local node (price and size).
|
||||||
func (pool *LegacyPool) validateTx(tx *types.Transaction, local bool) error {
|
func (pool *LegacyPool) validateTx(tx *types.Transaction) error {
|
||||||
opts := &txpool.ValidationOptionsWithState{
|
opts := &txpool.ValidationOptionsWithState{
|
||||||
State: pool.currentState,
|
State: pool.currentState,
|
||||||
|
|
||||||
|
|
@ -682,7 +682,7 @@ func (pool *LegacyPool) add(tx *types.Transaction, local bool) (replaced bool, e
|
||||||
isLocal := local || pool.locals.containsTx(tx)
|
isLocal := local || pool.locals.containsTx(tx)
|
||||||
|
|
||||||
// If the transaction fails basic validation, discard it
|
// If the transaction fails basic validation, discard it
|
||||||
if err := pool.validateTx(tx, isLocal); err != nil {
|
if err := pool.validateTx(tx); err != nil {
|
||||||
log.Trace("Discarding invalid transaction", "hash", hash, "err", err)
|
log.Trace("Discarding invalid transaction", "hash", hash, "err", err)
|
||||||
invalidTxMeter.Mark(1)
|
invalidTxMeter.Mark(1)
|
||||||
return false, err
|
return false, err
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue