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
0af1ab0c
Unverified
Commit
0af1ab0c
authored
Oct 20, 2017
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: avoid warning when loading the transaction journal
parent
65738c1e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
tx_journal.go
core/tx_journal.go
+13
-0
No files found.
core/tx_journal.go
View file @
0af1ab0c
...
...
@@ -31,6 +31,15 @@ import (
// into the journal, but no such file is currently open.
var
errNoActiveJournal
=
errors
.
New
(
"no active journal"
)
// devNull is a WriteCloser that just discards anything written into it. Its
// goal is to allow the transaction journal to write into a fake journal when
// loading transactions on startup without printing warnings due to no file
// being readt for write.
type
devNull
struct
{}
func
(
*
devNull
)
Write
(
p
[]
byte
)
(
n
int
,
err
error
)
{
return
len
(
p
),
nil
}
func
(
*
devNull
)
Close
()
error
{
return
nil
}
// txJournal is a rotating log of transactions with the aim of storing locally
// created transactions to allow non-executed ones to survive node restarts.
type
txJournal
struct
{
...
...
@@ -59,6 +68,10 @@ func (journal *txJournal) load(add func(*types.Transaction) error) error {
}
defer
input
.
Close
()
// Temporarilly discard any journal additions (don't double add on load)
journal
.
writer
=
new
(
devNull
)
defer
func
()
{
journal
.
writer
=
nil
}()
// Inject all transactions from the journal into the pool
stream
:=
rlp
.
NewStream
(
input
,
0
)
total
,
dropped
:=
0
,
0
...
...
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