mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 09:37:38 +00:00
E3: some clean (#6209)
This commit is contained in:
parent
1398703bc5
commit
061c4ef744
@ -184,6 +184,8 @@ func (rs *State22) RegisterSender(txTask *exec22.TxTask) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (rs *State22) CommitTxNum(sender *common.Address, txNum uint64) uint64 {
|
func (rs *State22) CommitTxNum(sender *common.Address, txNum uint64) uint64 {
|
||||||
|
rs.txsDone.Add(1)
|
||||||
|
|
||||||
rs.triggerLock.Lock()
|
rs.triggerLock.Lock()
|
||||||
defer rs.triggerLock.Unlock()
|
defer rs.triggerLock.Unlock()
|
||||||
count := uint64(0)
|
count := uint64(0)
|
||||||
@ -199,7 +201,6 @@ func (rs *State22) CommitTxNum(sender *common.Address, txNum uint64) uint64 {
|
|||||||
delete(rs.senderTxNums, *sender)
|
delete(rs.senderTxNums, *sender)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.txsDone.Add(1)
|
|
||||||
return count
|
return count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,7 +552,7 @@ Loop:
|
|||||||
if err := rs.ApplyState(applyTx, txTask, agg); err != nil {
|
if err := rs.ApplyState(applyTx, txTask, agg); err != nil {
|
||||||
panic(fmt.Errorf("State22.Apply: %w", err))
|
panic(fmt.Errorf("State22.Apply: %w", err))
|
||||||
}
|
}
|
||||||
rs.CommitTxNum(txTask.Sender, txTask.TxNum)
|
triggerCount.Add(rs.CommitTxNum(txTask.Sender, txTask.TxNum))
|
||||||
outputTxNum.Inc()
|
outputTxNum.Inc()
|
||||||
outputBlockNum.Store(txTask.BlockNum)
|
outputBlockNum.Store(txTask.BlockNum)
|
||||||
if err := rs.ApplyHistory(applyTx, txTask, agg); err != nil {
|
if err := rs.ApplyHistory(applyTx, txTask, agg); err != nil {
|
||||||
@ -668,8 +668,9 @@ func blockWithSenders(db kv.RoDB, tx kv.Tx, blockReader services.BlockReader, bl
|
|||||||
}
|
}
|
||||||
|
|
||||||
func processResultQueue(rws *exec22.TxTaskQueue, outputTxNum *atomic2.Uint64, rs *state.State22, agg *state2.Aggregator22, applyTx kv.Tx, triggerCount, outputBlockNum, repeatCount *atomic2.Uint64, resultsSize *atomic2.Int64, onSuccess func()) {
|
func processResultQueue(rws *exec22.TxTaskQueue, outputTxNum *atomic2.Uint64, rs *state.State22, agg *state2.Aggregator22, applyTx kv.Tx, triggerCount, outputBlockNum, repeatCount *atomic2.Uint64, resultsSize *atomic2.Int64, onSuccess func()) {
|
||||||
|
var txTask *exec22.TxTask
|
||||||
for rws.Len() > 0 && (*rws)[0].TxNum == outputTxNum.Load() {
|
for rws.Len() > 0 && (*rws)[0].TxNum == outputTxNum.Load() {
|
||||||
txTask := heap.Pop(rws).(*exec22.TxTask)
|
txTask = heap.Pop(rws).(*exec22.TxTask)
|
||||||
resultsSize.Add(-txTask.ResultsSize)
|
resultsSize.Add(-txTask.ResultsSize)
|
||||||
if txTask.Error != nil || !rs.ReadsValid(txTask.ReadLists) {
|
if txTask.Error != nil || !rs.ReadsValid(txTask.ReadLists) {
|
||||||
rs.AddWork(txTask)
|
rs.AddWork(txTask)
|
||||||
@ -683,13 +684,15 @@ func processResultQueue(rws *exec22.TxTaskQueue, outputTxNum *atomic2.Uint64, rs
|
|||||||
}
|
}
|
||||||
triggerCount.Add(rs.CommitTxNum(txTask.Sender, txTask.TxNum))
|
triggerCount.Add(rs.CommitTxNum(txTask.Sender, txTask.TxNum))
|
||||||
outputTxNum.Inc()
|
outputTxNum.Inc()
|
||||||
outputBlockNum.Store(txTask.BlockNum)
|
|
||||||
onSuccess()
|
onSuccess()
|
||||||
if err := rs.ApplyHistory(applyTx, txTask, agg); err != nil {
|
if err := rs.ApplyHistory(applyTx, txTask, agg); err != nil {
|
||||||
panic(fmt.Errorf("State22.Apply: %w", err))
|
panic(fmt.Errorf("State22.Apply: %w", err))
|
||||||
}
|
}
|
||||||
//fmt.Printf("Applied %d block %d txIndex %d\n", txTask.TxNum, txTask.BlockNum, txTask.TxIndex)
|
//fmt.Printf("Applied %d block %d txIndex %d\n", txTask.TxNum, txTask.BlockNum, txTask.TxIndex)
|
||||||
}
|
}
|
||||||
|
if txTask != nil {
|
||||||
|
outputBlockNum.Store(txTask.BlockNum)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ReconstituteState(ctx context.Context, s *StageState, dirs datadir.Dirs, workerCount int, batchSize datasize.ByteSize, chainDb kv.RwDB,
|
func ReconstituteState(ctx context.Context, s *StageState, dirs datadir.Dirs, workerCount int, batchSize datasize.ByteSize, chainDb kv.RwDB,
|
||||||
|
Loading…
Reference in New Issue
Block a user