mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-19 22:40:31 +00:00
fix bug
This commit is contained in:
parent
54ea85ae41
commit
9afb491d80
1 changed files with 5 additions and 31 deletions
|
|
@ -31,11 +31,11 @@ import (
|
||||||
// to which it belongs as well as the block number in which it was included for
|
// to which it belongs as well as the block number in which it was included for
|
||||||
// finality eviction.
|
// finality eviction.
|
||||||
type limboBlob struct {
|
type limboBlob struct {
|
||||||
TxHash common.Hash // Owner transaction's hash to support resurrecting reorged txs
|
TxHash common.Hash // Owner transaction's hash to support resurrecting reorged txs
|
||||||
Block uint64 // Block in which the blob transaction was included
|
Block uint64 // Block in which the blob transaction was included
|
||||||
Tx *types.Transaction
|
Tx *types.Transaction `rlp:"nil"` // Optional full blob transaction (old storage style)
|
||||||
TxMeta *blobTxMeta `rlp:"omitempty"` // Optional blob transaction metadata.
|
TxMeta *blobTxMeta // the blob transaction metadata.
|
||||||
id uint64 // the billy id of limboBlob
|
id uint64 // the billy id of limboBlob
|
||||||
}
|
}
|
||||||
|
|
||||||
// limbo is a light, indexed database to temporarily store recently included
|
// limbo is a light, indexed database to temporarily store recently included
|
||||||
|
|
@ -86,13 +86,6 @@ func newLimbo(config *params.ChainConfig, datadir string) (*limbo, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Migrate any old-style limbo entries which stored full blob transactions
|
|
||||||
// instead of just the metadata.
|
|
||||||
if err = l.cleanTxStorage(); err != nil {
|
|
||||||
l.Close()
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return l, nil
|
return l, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,25 +118,6 @@ func (l *limbo) parseBlob(id uint64, data []byte) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// cleanTxStorage migrates any old-style limbo entries which stored the full
|
|
||||||
// blob transaction instead of just the metadata.
|
|
||||||
func (l *limbo) cleanTxStorage() error {
|
|
||||||
for _, item := range l.index {
|
|
||||||
if item.Tx == nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// Delete the old item which hash blob tx content.
|
|
||||||
if err := l.drop(item.TxMeta.hash); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
// Set the new one which has blob tx metadata.
|
|
||||||
if err := l.push(item.TxMeta, item.Block); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// finalize evicts all blobs belonging to a recently finalized block or older.
|
// finalize evicts all blobs belonging to a recently finalized block or older.
|
||||||
func (l *limbo) finalize(final *types.Header, fn func(id uint64, txHash common.Hash)) {
|
func (l *limbo) finalize(final *types.Header, fn func(id uint64, txHash common.Hash)) {
|
||||||
// Just in case there's no final block yet (network not yet merged, weird
|
// Just in case there's no final block yet (network not yet merged, weird
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue