mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
save
This commit is contained in:
parent
0fdd60a0d1
commit
9efb8e838b
@ -29,6 +29,7 @@ import (
|
||||
"github.com/ledgerwatch/erigon-lib/kv/kvcfg"
|
||||
"github.com/ledgerwatch/erigon/common"
|
||||
"github.com/ledgerwatch/erigon/common/dbutils"
|
||||
"github.com/ledgerwatch/erigon/core/rawdb"
|
||||
"github.com/ledgerwatch/erigon/core/state/historyv2read"
|
||||
"github.com/ledgerwatch/erigon/core/types/accounts"
|
||||
"github.com/ledgerwatch/log/v3"
|
||||
@ -54,7 +55,7 @@ type PlainState struct {
|
||||
accHistoryC, storageHistoryC kv.Cursor
|
||||
accChangesC, storageChangesC kv.CursorDupSort
|
||||
tx kv.Tx
|
||||
blockNr uint64
|
||||
blockNr, txNr uint64
|
||||
histV3 bool
|
||||
storage map[common.Address]*btree.BTree
|
||||
trace bool
|
||||
@ -83,6 +84,9 @@ func NewPlainState(tx kv.Tx, blockNr uint64, systemContractLookup map[common.Add
|
||||
ps.storageChangesC = c4
|
||||
}
|
||||
|
||||
if histV3 {
|
||||
ps.txNr, _ = rawdb.TxNums.Min(tx, blockNr)
|
||||
}
|
||||
return ps
|
||||
}
|
||||
|
||||
@ -105,7 +109,7 @@ func (s *PlainState) ForEachStorage(addr common.Address, startLocation common.Ha
|
||||
var accData []byte
|
||||
var err error
|
||||
if ttx, ok := s.tx.(kv.TemporalTx); ok {
|
||||
accData, err = historyv2read.GetAsOfV3(ttx, false /* storage */, addr[:], s.blockNr, s.histV3)
|
||||
accData, err = historyv2read.GetAsOfV3(ttx, false /* storage */, addr[:], s.txNr, s.histV3)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -187,7 +191,7 @@ func (s *PlainState) ReadAccountData(address common.Address) (*accounts.Account,
|
||||
var enc []byte
|
||||
var err error
|
||||
if ttx, ok := s.tx.(kv.TemporalTx); ok {
|
||||
enc, err = historyv2read.GetAsOfV3(ttx, false /* storage */, address[:], s.blockNr, s.histV3)
|
||||
enc, err = historyv2read.GetAsOfV3(ttx, false /* storage */, address[:], s.txNr, s.histV3)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -233,7 +237,7 @@ func (s *PlainState) ReadAccountStorage(address common.Address, incarnation uint
|
||||
var enc []byte
|
||||
var err error
|
||||
if ttx, ok := s.tx.(kv.TemporalTx); ok {
|
||||
enc, err = historyv2read.GetAsOfV3(ttx, true /* storage */, compositeKey, s.blockNr, s.histV3)
|
||||
enc, err = historyv2read.GetAsOfV3(ttx, true /* storage */, compositeKey, s.txNr, s.histV3)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -275,7 +279,7 @@ func (s *PlainState) ReadAccountIncarnation(address common.Address) (uint64, err
|
||||
var enc []byte
|
||||
var err error
|
||||
if ttx, ok := s.tx.(kv.TemporalTx); ok {
|
||||
enc, err = historyv2read.GetAsOfV3(ttx, false /* storage */, address[:], s.blockNr+1, s.histV3)
|
||||
enc, err = historyv2read.GetAsOfV3(ttx, false /* storage */, address[:], s.txNr+1, s.histV3)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
@ -127,7 +127,6 @@ func CreateHistoryStateReader(tx kv.Tx, blockNumber, txnIndex uint64, agg *state
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fmt.Printf("hist reader v3: bn=%d, txNum=%d\n", tx, blockNumber)
|
||||
r.SetTxNum(minTxNum + txnIndex)
|
||||
return r, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user