mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
Recsplit: add first byte of hash to txn payload (#2902)
This commit is contained in:
parent
8c6c9527db
commit
70461e4e68
@ -2743,7 +2743,7 @@ func recsplitLookup(chaindata, name string) error {
|
||||
start := time.Now()
|
||||
for g.HasNext() {
|
||||
word, _ = g.Next(word[:0])
|
||||
if _, err := parseCtx.ParseTransaction(word, 0, &slot, sender[:]); err != nil {
|
||||
if _, err := parseCtx.ParseTransaction(word[1:], 0, &slot, sender[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
wc++
|
||||
@ -2835,7 +2835,7 @@ RETRY:
|
||||
|
||||
for g.HasNext() {
|
||||
word, pos = g.Next(word[:0])
|
||||
if _, err := parseCtx.ParseTransaction(word, 0, &slot, sender[:]); err != nil {
|
||||
if _, err := parseCtx.ParseTransaction(word[1:], 0, &slot, sender[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := rs.AddKey(slot.IdHash[:], pos); err != nil {
|
||||
@ -3572,6 +3572,9 @@ func fixState(chaindata string) error {
|
||||
func dumpTxs(chaindata string, block uint64, totalBlocks int, name string) error {
|
||||
db := mdbx.MustOpen(chaindata)
|
||||
defer db.Close()
|
||||
chainConfig := tool.ChainConfigFromDB(db)
|
||||
chainID, _ := uint256.FromBig(chainConfig.ChainID)
|
||||
|
||||
tx, err := db.BeginRo(context.Background())
|
||||
if err != nil {
|
||||
return err
|
||||
@ -3597,6 +3600,9 @@ func dumpTxs(chaindata string, block uint64, totalBlocks int, name string) error
|
||||
i := 0
|
||||
numBuf := make([]byte, binary.MaxVarintLen64)
|
||||
blockEncoded := dbutils.EncodeBlockNumber(block)
|
||||
parseCtx := txpool.NewTxParseContext(*chainID)
|
||||
parseCtx.WithSender(false)
|
||||
slot := txpool.TxSlot{}
|
||||
k, v, e := bodies.Seek(blockEncoded)
|
||||
for ; k != nil && e == nil; k, v, e = bodies.Next() {
|
||||
bodyNum := binary.BigEndian.Uint64(k)
|
||||
@ -3615,6 +3621,10 @@ func dumpTxs(chaindata string, block uint64, totalBlocks int, name string) error
|
||||
if txId >= body.BaseTxId+uint64(body.TxAmount) {
|
||||
break
|
||||
}
|
||||
if _, err := parseCtx.ParseTransaction(tv, 0, &slot, nil); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
tv = append(append([]byte{}, slot.IdHash[:1]...), tv...)
|
||||
n := binary.PutUvarint(numBuf, uint64(len(tv)))
|
||||
if _, e = w.Write(numBuf[:n]); e != nil {
|
||||
return err
|
||||
|
@ -734,19 +734,16 @@ func (db *DB) commitCache(logit bool) {
|
||||
entriesUpdated := 0
|
||||
entriesDeleted := 0
|
||||
if err := db.kv.Update(context.Background(), func(tx kv.RwTx) error {
|
||||
c, err := tx.RwCursor(kv.Inodes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var err error
|
||||
db.kvCache.Ascend(func(i btree.Item) bool {
|
||||
di := i.(*DbItem)
|
||||
if di.val == nil {
|
||||
if err = c.Delete(di.key, nil); err != nil {
|
||||
if err = tx.Delete(kv.Inodes, di.key, nil); err != nil {
|
||||
return false
|
||||
}
|
||||
entriesUpdated++
|
||||
} else {
|
||||
if err = c.Put(di.key, di.val); err != nil {
|
||||
if err = tx.Put(kv.Inodes, di.key, di.val); err != nil {
|
||||
return false
|
||||
}
|
||||
entriesDeleted++
|
||||
|
Loading…
Reference in New Issue
Block a user