mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
Fix writer restoration in journal loading
Restore original writer after loading transactions from journal.
This commit is contained in:
parent
24338b8817
commit
d4dece7f86
1 changed files with 3 additions and 1 deletions
|
|
@ -58,6 +58,8 @@ func newTxJournal(path string) *journal {
|
||||||
// load parses a transaction journal dump from disk, loading its contents into
|
// load parses a transaction journal dump from disk, loading its contents into
|
||||||
// the specified pool.
|
// the specified pool.
|
||||||
func (journal *journal) load(add func([]*types.Transaction) []error) error {
|
func (journal *journal) load(add func([]*types.Transaction) []error) error {
|
||||||
|
originalWriter := journal.writer
|
||||||
|
|
||||||
// Open the journal for loading any past transactions
|
// Open the journal for loading any past transactions
|
||||||
input, err := os.Open(journal.path)
|
input, err := os.Open(journal.path)
|
||||||
if errors.Is(err, fs.ErrNotExist) {
|
if errors.Is(err, fs.ErrNotExist) {
|
||||||
|
|
@ -71,7 +73,7 @@ func (journal *journal) load(add func([]*types.Transaction) []error) error {
|
||||||
|
|
||||||
// Temporarily discard any journal additions (don't double add on load)
|
// Temporarily discard any journal additions (don't double add on load)
|
||||||
journal.writer = new(devNull)
|
journal.writer = new(devNull)
|
||||||
defer func() { journal.writer = nil }()
|
defer func() { journal.writer = originalWriter }()
|
||||||
|
|
||||||
// Inject all transactions from the journal into the pool
|
// Inject all transactions from the journal into the pool
|
||||||
stream := rlp.NewStream(input, 0)
|
stream := rlp.NewStream(input, 0)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue