Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
a50c006b
Unverified
Commit
a50c006b
authored
Aug 17, 2022
by
Seungbae Yu
Committed by
GitHub
Aug 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: make tx journal check and open atomic (#25530)
* core: reduce system call about `os` * avoid deprecated method
parent
6da5c164
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
tx_journal.go
core/tx_journal.go
+5
-4
No files found.
core/tx_journal.go
View file @
a50c006b
...
...
@@ -19,6 +19,7 @@ package core
import
(
"errors"
"io"
"io/fs"
"os"
"github.com/ethereum/go-ethereum/common"
...
...
@@ -57,12 +58,12 @@ func newTxJournal(path string) *txJournal {
// load parses a transaction journal dump from disk, loading its contents into
// the specified pool.
func
(
journal
*
txJournal
)
load
(
add
func
([]
*
types
.
Transaction
)
[]
error
)
error
{
// Open the journal for loading any past transactions
input
,
err
:=
os
.
Open
(
journal
.
path
)
if
errors
.
Is
(
err
,
fs
.
ErrNotExist
)
{
// Skip the parsing if the journal file doesn't exist at all
if
!
common
.
FileExist
(
journal
.
path
)
{
return
nil
}
// Open the journal for loading any past transactions
input
,
err
:=
os
.
Open
(
journal
.
path
)
if
err
!=
nil
{
return
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment