mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
persistence
This commit is contained in:
parent
d3f68af522
commit
c233bcb2e6
@ -600,7 +600,6 @@ func onNewTxs(senders *SendersCache, newTxs TxSlots, protocolBaseFee, pendingBas
|
||||
}
|
||||
}
|
||||
})
|
||||
fmt.Printf("aaa: %d\n", pending.Len())
|
||||
|
||||
for _, sender := range changedSenders {
|
||||
onSenderChange(sender, protocolBaseFee, pendingBaseFee)
|
||||
@ -609,6 +608,7 @@ func onNewTxs(senders *SendersCache, newTxs TxSlots, protocolBaseFee, pendingBas
|
||||
pending.EnforceInvariants()
|
||||
baseFee.EnforceInvariants()
|
||||
queued.EnforceInvariants()
|
||||
fmt.Printf("aaa2: %d, %d, %d\n", pending.Len(), baseFee.Len(), queued.Len())
|
||||
|
||||
promote(pending, baseFee, queued, func(i *metaTx) {
|
||||
delete(byHash, string(i.Tx.idHash[:]))
|
||||
@ -618,6 +618,7 @@ func onNewTxs(senders *SendersCache, newTxs TxSlots, protocolBaseFee, pendingBas
|
||||
localsHistory.Add(i.Tx.idHash, struct{}{})
|
||||
}
|
||||
})
|
||||
fmt.Printf("aaa3: %d, %d, %d\n", pending.Len(), baseFee.Len(), queued.Len())
|
||||
|
||||
return nil
|
||||
}
|
||||
@ -770,7 +771,6 @@ func (p *TxPool) fromDB(tx kv.Tx, senders *SendersCache) error {
|
||||
txs.txs[i] = &TxSlot{}
|
||||
_, err := parseCtx.ParseTransaction(v, 8+8, txs.txs[i], nil)
|
||||
if err != nil {
|
||||
fmt.Printf("ddd1 load: %s\n", err)
|
||||
return err
|
||||
}
|
||||
txs.txs[i].senderID = binary.BigEndian.Uint64(v)
|
||||
@ -780,21 +780,23 @@ func (p *TxPool) fromDB(tx kv.Tx, senders *SendersCache) error {
|
||||
txs.isLocal[i] = isLocalTx
|
||||
i++
|
||||
}
|
||||
fmt.Printf("ddd load: %d\n", len(p.byHash))
|
||||
|
||||
protocolBaseFee, err := tx.GetOne(kv.PoolInfo, []byte("protocol_base_fee"))
|
||||
protocolBaseFeeV, err := tx.GetOne(kv.PoolInfo, []byte("protocol_base_fee"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pendingBaseFee, err := tx.GetOne(kv.PoolInfo, []byte("pending_base_fee"))
|
||||
pendingBaseFeeV, err := tx.GetOne(kv.PoolInfo, []byte("pending_base_fee"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("a:%d,%d,%d\n", total, len(txs.txs), i)
|
||||
if err := onNewTxs(senders, txs, binary.BigEndian.Uint64(protocolBaseFee), binary.BigEndian.Uint64(pendingBaseFee), p.pending, p.baseFee, p.queued, p.byHash, p.localsHistory); err != nil {
|
||||
protocolBaseFee := binary.BigEndian.Uint64(protocolBaseFeeV)
|
||||
pendingBaseFee := binary.BigEndian.Uint64(pendingBaseFeeV)
|
||||
if err := onNewTxs(senders, txs, protocolBaseFee, pendingBaseFee, p.pending, p.baseFee, p.queued, p.byHash, p.localsHistory); err != nil {
|
||||
return err
|
||||
}
|
||||
p.pendingBaseFee.Store(pendingBaseFee)
|
||||
p.protocolBaseFee.Store(protocolBaseFee)
|
||||
|
||||
//TODO: flush deletes
|
||||
|
||||
@ -1034,7 +1036,7 @@ func promote(pending, baseFee, queued *SubPool, discard func(tx *metaTx)) {
|
||||
if worst.subPool >= 0b11111 { // TODO: here must 'subPool == 0b1111' or 'subPool <= 0b1111' ?
|
||||
break
|
||||
}
|
||||
pending.PopWorst()
|
||||
discard(pending.PopWorst())
|
||||
}
|
||||
|
||||
//3. If the top element in the best yellow queue has subPool == 0b1111, promote to the green pool.
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/google/btree"
|
||||
@ -503,6 +504,8 @@ func FuzzOnNewBlocks11(f *testing.F) {
|
||||
require.NoError(t, err)
|
||||
check(minedTxs1, TxSlots{}, "fromDB")
|
||||
checkNotify(minedTxs1, TxSlots{}, "fromDB")
|
||||
fmt.Printf("bef: %d, %d, %d\n", pool.pending.Len(), pool.baseFee.Len(), pool.queued.Len())
|
||||
fmt.Printf("bef2: %d, %d, %d\n", p2.pending.Len(), p2.baseFee.Len(), p2.queued.Len())
|
||||
assert.Equal(pool.pending.Len(), p2.pending.Len())
|
||||
assert.Equal(pool.baseFee.Len(), p2.baseFee.Len())
|
||||
assert.Equal(pool.queued.Len(), p2.queued.Len())
|
||||
|
@ -152,7 +152,6 @@ func (ctx *TxParseContext) ParseTransaction(payload []byte, pos int, slot *TxSlo
|
||||
}
|
||||
dataPos, dataLen, err = rlp.List(payload, p)
|
||||
if err != nil {
|
||||
fmt.Printf("ii: %d, %x, %x\n", p, payload, payload[8:])
|
||||
return 0, fmt.Errorf("%s: envelope Prefix: %v", ParseTransactionErrorPrefix, err)
|
||||
}
|
||||
// Hash the envelope, not the full payload
|
||||
|
Loading…
Reference in New Issue
Block a user