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
d2ab3222
Commit
d2ab3222
authored
Apr 30, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed debugging log
parent
c3293641
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
20 deletions
+14
-20
transaction_pool.go
ethchain/transaction_pool.go
+10
-8
peer.go
peer.go
+4
-12
No files found.
ethchain/transaction_pool.go
View file @
d2ab3222
...
...
@@ -91,14 +91,16 @@ func (pool *TxPool) addTransaction(tx *Transaction) {
// Process transaction validates the Tx and processes funds from the
// sender to the recipient.
func
(
pool
*
TxPool
)
ProcessTransaction
(
tx
*
Transaction
,
block
*
Block
,
toContract
bool
)
(
err
error
)
{
/*
defer func() {
if r := recover(); r != nil {
log.Println(r)
err = fmt.Errorf("%v", r)
}
}()
*/
// Get the sender
sender
:=
block
.
state
.
Get
StateObjec
t
(
tx
.
Sender
())
sender
:=
block
.
state
.
Get
Accoun
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 +114,7 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block, toContract
}
// Get the receiver
receiver
:=
block
.
state
.
Get
StateObjec
t
(
tx
.
Recipient
)
receiver
:=
block
.
state
.
Get
Accoun
t
(
tx
.
Recipient
)
sender
.
Nonce
+=
1
// Send Tx to self
...
...
peer.go
View file @
d2ab3222
...
...
@@ -320,14 +320,11 @@ func (p *Peer) HandleInbound() {
// We requested blocks and now we need to make sure we have a common ancestor somewhere in these blocks so we can find
// common ground to start syncing from
lastBlock
=
ethchain
.
NewBlockFromRlpValue
(
msg
.
Data
.
Get
(
msg
.
Data
.
Len
()
-
1
))
if
p
.
ethereum
.
StateManager
()
.
BlockChain
()
.
HasBlock
(
lastBlock
.
Hash
())
{
fmt
.
Println
(
"[PEER] We found a common ancestor, let's continue."
)
}
else
{
if
!
p
.
ethereum
.
StateManager
()
.
BlockChain
()
.
HasBlock
(
lastBlock
.
Hash
())
{
// If we can't find a common ancenstor we need to request more blocks.
// FIXME: At one point this won't scale anymore since we are not asking for an offset
// we just keep increasing the amount of blocks.
fmt
.
Println
(
"[PEER] No common ancestor found, requesting more blocks."
)
//
fmt.Println("[PEER] No common ancestor found, requesting more blocks.")
p
.
blocksRequested
=
p
.
blocksRequested
*
2
p
.
catchingUp
=
false
p
.
SyncWithBlocks
()
...
...
@@ -336,17 +333,13 @@ func (p *Peer) HandleInbound() {
for
i
:=
msg
.
Data
.
Len
()
-
1
;
i
>=
0
;
i
--
{
block
=
ethchain
.
NewBlockFromRlpValue
(
msg
.
Data
.
Get
(
i
))
// Do we have this block on our chain? If so we can continue
if
p
.
ethereum
.
StateManager
()
.
BlockChain
()
.
HasBlock
(
block
.
Hash
())
{
ethutil
.
Config
.
Log
.
Debugf
(
"[PEER] Block found, checking next one.
\n
"
)
}
else
{
if
!
p
.
ethereum
.
StateManager
()
.
BlockChain
()
.
HasBlock
(
block
.
Hash
())
{
// We don't have this block, but we do have a block with the same prevHash, diversion time!
if
p
.
ethereum
.
StateManager
()
.
BlockChain
()
.
HasBlockWithPrevHash
(
block
.
PrevHash
)
{
ethutil
.
Config
.
Log
.
Infof
(
"[PEER] Local and foreign chain have diverted after %x, finding best chain!
\n
"
,
block
.
PrevHash
)
//
ethutil.Config.Log.Infof("[PEER] Local and foreign chain have diverted after %x, finding best chain!\n", block.PrevHash)
if
p
.
ethereum
.
StateManager
()
.
BlockChain
()
.
FindCanonicalChainFromMsg
(
msg
,
block
.
PrevHash
)
{
return
}
}
else
{
ethutil
.
Config
.
Log
.
Debugf
(
"[PEER] Both local and foreign chain have same parent. Continue normally
\n
"
)
}
}
}
...
...
@@ -644,7 +637,6 @@ func (p *Peer) SyncWithBlocks() {
for
_
,
block
:=
range
blocks
{
hashes
=
append
(
hashes
,
block
.
Hash
())
}
fmt
.
Printf
(
"Requesting hashes from network: %x"
,
hashes
)
msgInfo
:=
append
(
hashes
,
uint64
(
50
))
...
...
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