mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 22:26:42 +00:00
upstream: fixed txpool/* and state/*
This commit is contained in:
parent
e53660318e
commit
7e115f3519
7 changed files with 14 additions and 24 deletions
|
|
@ -416,7 +416,7 @@ func (s *StateDB) ApplyMVWriteSet(writes []blockstm.WriteDescriptor) {
|
|||
case BalancePath:
|
||||
s.SetBalance(addr, sr.GetBalance(addr), tracing.BalanceChangeUnspecified)
|
||||
case NoncePath:
|
||||
s.SetNonce(addr, sr.GetNonce(addr))
|
||||
s.SetNonce(addr, sr.GetNonce(addr), tracing.NonceChangeUnspecified)
|
||||
case CodePath:
|
||||
s.SetCode(addr, sr.GetCode(addr))
|
||||
case SuicidePath:
|
||||
|
|
@ -664,20 +664,13 @@ func (s *StateDB) Version() blockstm.Version {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *StateDB) GetCode(addr common.Address) []byte {
|
||||
stateObject := s.getStateObject(addr)
|
||||
if stateObject != nil {
|
||||
if s.witness != nil {
|
||||
s.witness.AddCode(stateObject.Code())
|
||||
}
|
||||
return stateObject.Code()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *StateDB) GetCode(addr common.Address) []byte {
|
||||
return MVRead(s, blockstm.NewSubpathKey(addr, CodePath), nil, func(s *StateDB) []byte {
|
||||
stateObject := s.getStateObject(addr)
|
||||
if stateObject != nil {
|
||||
if s.witness != nil {
|
||||
s.witness.AddCode(stateObject.Code())
|
||||
}
|
||||
return stateObject.Code()
|
||||
}
|
||||
|
||||
|
|
@ -965,7 +958,7 @@ func (s *StateDB) updateStateObject(obj *stateObject) {
|
|||
// deleteStateObject removes the given object from the state trie.
|
||||
func (s *StateDB) deleteStateObject(addr common.Address) {
|
||||
// Track the amount of time wasted on deleting the account from the trie
|
||||
if metrics.Enabled {
|
||||
if metrics.Enabled() {
|
||||
defer func(start time.Time) { s.AccountUpdates += time.Since(start) }(time.Now())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1185,13 +1185,13 @@ func TestApplyMVWriteSet(t *testing.T) {
|
|||
// Tx1 write
|
||||
states[1].SetState(addr1, key2, val2)
|
||||
states[1].SetBalance(addr1, balance2, tracing.BalanceChangeTransfer)
|
||||
states[1].SetNonce(addr1, 1)
|
||||
states[1].SetNonce(addr1, 1, tracing.NonceChangeUnspecified)
|
||||
states[1].Finalise(true)
|
||||
states[1].FlushMVWriteSet()
|
||||
|
||||
sSingleProcess.SetState(addr1, key2, val2)
|
||||
sSingleProcess.SetBalance(addr1, balance2, tracing.BalanceChangeTransfer)
|
||||
sSingleProcess.SetNonce(addr1, 1)
|
||||
sSingleProcess.SetNonce(addr1, 1, tracing.NonceChangeUnspecified)
|
||||
|
||||
sClean.ApplyMVWriteSet(states[1].MVWriteList())
|
||||
|
||||
|
|
@ -1200,13 +1200,13 @@ func TestApplyMVWriteSet(t *testing.T) {
|
|||
// Tx2 write
|
||||
states[2].SetState(addr1, key1, val2)
|
||||
states[2].SetBalance(addr1, balance2, tracing.BalanceChangeTransfer)
|
||||
states[2].SetNonce(addr1, 2)
|
||||
states[2].SetNonce(addr1, 2, tracing.NonceChangeUnspecified)
|
||||
states[2].Finalise(true)
|
||||
states[2].FlushMVWriteSet()
|
||||
|
||||
sSingleProcess.SetState(addr1, key1, val2)
|
||||
sSingleProcess.SetBalance(addr1, balance2, tracing.BalanceChangeTransfer)
|
||||
sSingleProcess.SetNonce(addr1, 2)
|
||||
sSingleProcess.SetNonce(addr1, 2, tracing.NonceChangeUnspecified)
|
||||
|
||||
sClean.ApplyMVWriteSet(states[2].MVWriteList())
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ func (bc *testBlockChain) CurrentBlock() *types.Header {
|
|||
tmp := mid.Uint64()
|
||||
if eip4844.CalcBlobFee(bc.Config(), &types.Header{
|
||||
Number: blockNumber,
|
||||
Time: blockTime,
|
||||
Time: uint64(blockTime),
|
||||
ExcessBlobGas: &tmp,
|
||||
}).Cmp(bc.blobfee.ToBig()) > 0 {
|
||||
hi = mid
|
||||
|
|
|
|||
|
|
@ -1653,9 +1653,6 @@ func (pool *LegacyPool) demoteUnexecutables() {
|
|||
}
|
||||
|
||||
pendingGauge.Dec(int64(len(olds) + len(drops) + len(invalids) + len(txConditionalsRemoved)))
|
||||
if pool.locals.contains(addr) {
|
||||
localGauge.Dec(int64(len(olds) + len(drops) + len(invalids) + len(txConditionalsRemoved)))
|
||||
}
|
||||
// If there's a gap in front, alert (should never happen) and postpone all transactions
|
||||
if list.Len() > 0 && list.txs.Get(nonce) == nil {
|
||||
gapped := list.Cap(0)
|
||||
|
|
|
|||
|
|
@ -3168,7 +3168,7 @@ func TestPoolMultiAccountBatchInsertRace(t *testing.T) {
|
|||
pending = pool.Pending(txpool.PendingFilter{})
|
||||
total = len(pending)
|
||||
|
||||
_ = pool.Locals()
|
||||
// _ = pool.Locals()
|
||||
|
||||
if total >= n {
|
||||
close(done)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ func (m *SortedMap) Get(nonce uint64) *types.Transaction {
|
|||
return m.items[nonce]
|
||||
}
|
||||
|
||||
func (m *sortedMap) Has(nonce uint64) bool {
|
||||
func (m *SortedMap) Has(nonce uint64) bool {
|
||||
if m == nil {
|
||||
return false
|
||||
}
|
||||
|
|
@ -273,7 +273,7 @@ func (m *SortedMap) flatten() types.Transactions {
|
|||
return m.cache
|
||||
}
|
||||
|
||||
func (m *sortedMap) lastElement() *types.Transaction {
|
||||
func (m *SortedMap) lastElement() *types.Transaction {
|
||||
cache := m.flatten()
|
||||
return cache[len(cache)-1]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ func newTestEnv(t *testing.T, n int, gasTip uint64, journal string) *testEnv {
|
|||
})
|
||||
|
||||
db := rawdb.NewMemoryDatabase()
|
||||
chain, _ := core.NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil)
|
||||
chain, _ := core.NewBlockChain(db, nil, gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil, nil)
|
||||
|
||||
legacyPool := legacypool.New(legacypool.DefaultConfig, chain)
|
||||
pool, err := txpool.New(gasTip, chain, []txpool.SubPool{legacyPool})
|
||||
|
|
|
|||
Loading…
Reference in a new issue