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
7bf2ae0b
Commit
7bf2ae0b
authored
May 15, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed old tx pool notification system. Fixes #19
parent
2734fc40
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
20 deletions
+9
-20
block_chain.go
ethchain/block_chain.go
+2
-1
transaction_pool.go
ethchain/transaction_pool.go
+3
-16
miner.go
ethminer/miner.go
+2
-2
reactor.go
ethutil/reactor.go
+2
-1
No files found.
ethchain/block_chain.go
View file @
7bf2ae0b
...
...
@@ -260,7 +260,7 @@ func AddTestNetFunds(block *Block) {
"e6716f9544a56c530d868e4bfbacb172315bdead"
,
// Jeffrey
"1e12515ce3e0f817a4ddef9ca55788a1d66bd2df"
,
// Vit
"1a26338f0d905e295fccb71fa9ea849ffa12aaf4"
,
// Alex
"2ef47100e0787b915105fd5e3f4ff6752079d5cb"
,
// Maran
//
"2ef47100e0787b915105fd5e3f4ff6752079d5cb", // Maran
}
{
//log.Println("2^200 Wei to", addr)
codedAddr
:=
ethutil
.
FromHex
(
addr
)
...
...
@@ -268,6 +268,7 @@ func AddTestNetFunds(block *Block) {
account
.
Amount
=
ethutil
.
BigPow
(
2
,
200
)
block
.
state
.
UpdateStateObject
(
account
)
}
log
.
Printf
(
"%x
\n
"
,
block
.
RlpEncode
())
}
func
(
bc
*
BlockChain
)
setLastBlock
()
{
...
...
ethchain/transaction_pool.go
View file @
7bf2ae0b
...
...
@@ -133,7 +133,8 @@ func (pool *TxPool) ProcessTransaction(tx *Transaction, block *Block, toContract
log
.
Printf
(
"[TXPL] Processed Tx %x
\n
"
,
tx
.
Hash
())
pool
.
notifySubscribers
(
TxPost
,
tx
)
// Notify all subscribers
pool
.
Ethereum
.
Reactor
()
.
Post
(
"newTx:post"
,
tx
)
return
}
...
...
@@ -188,10 +189,7 @@ out:
pool
.
addTransaction
(
tx
)
// Notify the subscribers
pool
.
Ethereum
.
Reactor
()
.
Post
(
"newTx"
,
tx
)
// Notify the subscribers
pool
.
notifySubscribers
(
TxPre
,
tx
)
pool
.
Ethereum
.
Reactor
()
.
Post
(
"newTx:pre"
,
tx
)
}
case
<-
pool
.
quit
:
break
out
...
...
@@ -252,14 +250,3 @@ func (pool *TxPool) Stop() {
log
.
Println
(
"[TXP] Stopped"
)
}
func
(
pool
*
TxPool
)
Subscribe
(
channel
chan
TxMsg
)
{
pool
.
subscribers
=
append
(
pool
.
subscribers
,
channel
)
}
func
(
pool
*
TxPool
)
notifySubscribers
(
ty
TxMsgTy
,
tx
*
Transaction
)
{
msg
:=
TxMsg
{
Type
:
ty
,
Tx
:
tx
}
for
_
,
subscriber
:=
range
pool
.
subscribers
{
subscriber
<-
msg
}
}
ethminer/miner.go
View file @
7bf2ae0b
...
...
@@ -26,7 +26,7 @@ func NewDefaultMiner(coinbase []byte, ethereum ethchain.EthManager) Miner {
quitChan
:=
make
(
chan
ethutil
.
React
,
1
)
// This is the channel that can exit the miner thread
ethereum
.
Reactor
()
.
Subscribe
(
"newBlock"
,
reactChan
)
ethereum
.
Reactor
()
.
Subscribe
(
"newTx"
,
reactChan
)
ethereum
.
Reactor
()
.
Subscribe
(
"newTx
:post
"
,
reactChan
)
// We need the quit chan to be a Reactor event.
// The POW search method is actually blocking and if we don't
...
...
@@ -34,7 +34,7 @@ func NewDefaultMiner(coinbase []byte, ethereum ethchain.EthManager) Miner {
// The miner overseer will never get the reactor events themselves
// Only after the miner will find the sha
ethereum
.
Reactor
()
.
Subscribe
(
"newBlock"
,
quitChan
)
ethereum
.
Reactor
()
.
Subscribe
(
"newTx"
,
quitChan
)
ethereum
.
Reactor
()
.
Subscribe
(
"newTx
:post
"
,
quitChan
)
miner
:=
Miner
{
pow
:
&
ethchain
.
EasyPow
{},
...
...
ethutil/reactor.go
View file @
7bf2ae0b
...
...
@@ -46,6 +46,7 @@ func (e *ReactorEvent) Remove(ch chan React) {
// Basic reactor resource
type
React
struct
{
Resource
interface
{}
Event
string
}
// The reactor basic engine. Acts as bridge
...
...
@@ -81,6 +82,6 @@ func (reactor *ReactorEngine) Unsubscribe(event string, ch chan React) {
func
(
reactor
*
ReactorEngine
)
Post
(
event
string
,
resource
interface
{})
{
ev
:=
reactor
.
patterns
[
event
]
if
ev
!=
nil
{
ev
.
Post
(
React
{
Resource
:
resource
})
ev
.
Post
(
React
{
Resource
:
resource
,
Event
:
event
})
}
}
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