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
a953f3ec
Commit
a953f3ec
authored
Apr 08, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sync managed accounts to the network
parent
31b086f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
transaction_pool.go
core/transaction_pool.go
+2
-3
backend.go
eth/backend.go
+15
-0
No files found.
core/transaction_pool.go
View file @
a953f3ec
...
@@ -90,6 +90,7 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error {
...
@@ -90,6 +90,7 @@ func (pool *TxPool) ValidateTransaction(tx *types.Transaction) error {
}
}
func
(
self
*
TxPool
)
addTx
(
tx
*
types
.
Transaction
)
{
func
(
self
*
TxPool
)
addTx
(
tx
*
types
.
Transaction
)
{
self
.
txs
[
tx
.
Hash
()]
=
tx
}
}
func
(
self
*
TxPool
)
add
(
tx
*
types
.
Transaction
)
error
{
func
(
self
*
TxPool
)
add
(
tx
*
types
.
Transaction
)
error
{
...
@@ -107,7 +108,7 @@ func (self *TxPool) add(tx *types.Transaction) error {
...
@@ -107,7 +108,7 @@ func (self *TxPool) add(tx *types.Transaction) error {
return
err
return
err
}
}
self
.
txs
[
hash
]
=
tx
self
.
addTx
(
tx
)
var
toname
string
var
toname
string
if
to
:=
tx
.
To
();
to
!=
nil
{
if
to
:=
tx
.
To
();
to
!=
nil
{
...
@@ -122,9 +123,7 @@ func (self *TxPool) add(tx *types.Transaction) error {
...
@@ -122,9 +123,7 @@ func (self *TxPool) add(tx *types.Transaction) error {
txplogger
.
Debugf
(
"(t) %x => %s (%v) %x
\n
"
,
from
,
toname
,
tx
.
Value
,
tx
.
Hash
())
txplogger
.
Debugf
(
"(t) %x => %s (%v) %x
\n
"
,
from
,
toname
,
tx
.
Value
,
tx
.
Hash
())
// Notify the subscribers
// Notify the subscribers
//println("post")
go
self
.
eventMux
.
Post
(
TxPreEvent
{
tx
})
go
self
.
eventMux
.
Post
(
TxPreEvent
{
tx
})
//println("done post")
return
nil
return
nil
}
}
...
...
eth/backend.go
View file @
a953f3ec
...
@@ -436,6 +436,21 @@ func (self *Ethereum) txBroadcastLoop() {
...
@@ -436,6 +436,21 @@ func (self *Ethereum) txBroadcastLoop() {
for
obj
:=
range
self
.
txSub
.
Chan
()
{
for
obj
:=
range
self
.
txSub
.
Chan
()
{
event
:=
obj
.
(
core
.
TxPreEvent
)
event
:=
obj
.
(
core
.
TxPreEvent
)
self
.
net
.
Broadcast
(
"eth"
,
TxMsg
,
[]
*
types
.
Transaction
{
event
.
Tx
})
self
.
net
.
Broadcast
(
"eth"
,
TxMsg
,
[]
*
types
.
Transaction
{
event
.
Tx
})
self
.
syncAccounts
(
event
.
Tx
)
}
}
// keep accounts synced up
func
(
self
*
Ethereum
)
syncAccounts
(
tx
*
types
.
Transaction
)
{
from
,
err
:=
tx
.
From
()
if
err
!=
nil
{
return
}
if
self
.
accountManager
.
HasAccount
(
from
.
Bytes
())
{
if
self
.
chainManager
.
TxState
()
.
GetNonce
(
from
)
<
tx
.
Nonce
()
{
self
.
chainManager
.
TxState
()
.
SetNonce
(
from
,
tx
.
Nonce
()
+
1
)
}
}
}
}
}
...
...
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