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
c3293641
Commit
c3293641
authored
Apr 30, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed debug logging
parent
21724f7e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
9 deletions
+26
-9
error.go
ethchain/error.go
+22
-1
state_manager.go
ethchain/state_manager.go
+1
-1
transaction_pool.go
ethchain/transaction_pool.go
+3
-7
No files found.
ethchain/error.go
View file @
c3293641
package
ethchain
import
"fmt"
import
(
"fmt"
)
// Parent error. In case a parent is unknown this error will be thrown
// by the block manager
...
...
@@ -40,3 +42,22 @@ func IsValidationErr(err error) bool {
return
ok
}
type
NonceErr
struct
{
Message
string
Is
,
Exp
uint64
}
func
(
err
*
NonceErr
)
Error
()
string
{
return
err
.
Message
}
func
NonceError
(
is
,
exp
uint64
)
*
NonceErr
{
return
&
NonceErr
{
Message
:
fmt
.
Sprintf
(
"Nonce err. Is %d, expected %d"
,
is
,
exp
),
Is
:
is
,
Exp
:
exp
}
}
func
IsNonceErr
(
err
error
)
bool
{
_
,
ok
:=
err
.
(
*
NonceErr
)
return
ok
}
ethchain/state_manager.go
View file @
c3293641
...
...
@@ -157,7 +157,7 @@ func (sm *StateManager) ProcessBlock(block *Block, dontReact bool) error {
hash
:=
block
.
Hash
()
if
sm
.
bc
.
HasBlock
(
hash
)
{
fmt
.
Println
(
"[STATE] We already have this block, ignoring"
)
//
fmt.Println("[STATE] We already have this block, ignoring")
return
nil
}
...
...
ethchain/transaction_pool.go
View file @
c3293641
...
...
@@ -98,7 +98,7 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block, toContract
}
}()
// Get the sender
sender
:=
block
.
state
.
Get
Accoun
t
(
tx
.
Sender
())
sender
:=
block
.
state
.
Get
StateObjec
t
(
tx
.
Sender
())
if
sender
.
Nonce
!=
tx
.
Nonce
{
return
fmt
.
Errorf
(
"[TXPL] Invalid account nonce, state nonce is %d transaction nonce is %d instead"
,
sender
.
Nonce
,
tx
.
Nonce
)
...
...
@@ -112,7 +112,7 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block, toContract
}
// Get the receiver
receiver
:=
block
.
state
.
Get
Accoun
t
(
tx
.
Recipient
)
receiver
:=
block
.
state
.
Get
StateObjec
t
(
tx
.
Recipient
)
sender
.
Nonce
+=
1
// Send Tx to self
...
...
@@ -169,7 +169,6 @@ out:
for
{
select
{
case
tx
:=
<-
pool
.
queueChan
:
log
.
Println
(
"Received new Tx to queue"
)
hash
:=
tx
.
Hash
()
foundTx
:=
FindTx
(
pool
.
pool
,
func
(
tx
*
Transaction
,
e
*
list
.
Element
)
bool
{
return
bytes
.
Compare
(
tx
.
Hash
(),
hash
)
==
0
...
...
@@ -186,11 +185,8 @@ out:
log
.
Println
(
"Validating Tx failed"
,
err
)
}
}
else
{
log
.
Println
(
"Transaction ok, adding"
)
// Call blocking version. At this point it
// doesn't matter since this is a goroutine
// Call blocking version.
pool
.
addTransaction
(
tx
)
log
.
Println
(
"Added"
)
// Notify the subscribers
pool
.
Ethereum
.
Reactor
()
.
Post
(
"newTx"
,
tx
)
...
...
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