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
b8886522
Commit
b8886522
authored
Mar 28, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added missing GetTx (0x16) wire message
parent
60fd2f35
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
3 deletions
+25
-3
transaction_pool.go
ethchain/transaction_pool.go
+7
-1
messaging.go
ethwire/messaging.go
+2
-0
peer.go
peer.go
+16
-2
No files found.
ethchain/transaction_pool.go
View file @
b8886522
...
...
@@ -207,7 +207,7 @@ func (pool *TxPool) QueueTransaction(tx *Transaction) {
pool
.
queueChan
<-
tx
}
func
(
pool
*
TxPool
)
Flush
()
[]
*
Transaction
{
func
(
pool
*
TxPool
)
CurrentTransactions
()
[]
*
Transaction
{
pool
.
mutex
.
Lock
()
defer
pool
.
mutex
.
Unlock
()
...
...
@@ -221,6 +221,12 @@ func (pool *TxPool) Flush() []*Transaction {
i
++
}
return
txList
}
func
(
pool
*
TxPool
)
Flush
()
[]
*
Transaction
{
txList
:=
pool
.
CurrentTransactions
()
// Recreate a new list all together
// XXX Is this the fastest way?
pool
.
pool
=
list
.
New
()
...
...
ethwire/messaging.go
View file @
b8886522
...
...
@@ -32,6 +32,7 @@ const (
MsgBlockTy
=
0x13
MsgGetChainTy
=
0x14
MsgNotInChainTy
=
0x15
MsgGetTxsTy
=
0x16
MsgTalkTy
=
0xff
)
...
...
@@ -46,6 +47,7 @@ var msgTypeToString = map[MsgType]string{
MsgTxTy
:
"Transactions"
,
MsgBlockTy
:
"Blocks"
,
MsgGetChainTy
:
"Get chain"
,
MsgGetTxsTy
:
"Get Txs"
,
MsgNotInChainTy
:
"Not in chain"
,
}
...
...
peer.go
View file @
b8886522
...
...
@@ -334,8 +334,8 @@ func (p *Peer) HandleInbound() {
// in the TxPool where it will undergo validation and
// processing when a new block is found
for
i
:=
0
;
i
<
msg
.
Data
.
Len
();
i
++
{
//p.ethereum.TxPool().QueueTransaction(ethchain.NewTransactionFromData(msg.Data.Get(i).Encode()
))
p
.
ethereum
.
TxPool
()
.
QueueTransaction
(
ethchain
.
NewTransactionFromValue
(
msg
.
Data
.
Get
(
i
))
)
tx
:=
ethchain
.
NewTransactionFromValue
(
msg
.
Data
.
Get
(
i
))
p
.
ethereum
.
TxPool
()
.
QueueTransaction
(
tx
)
}
case
ethwire
.
MsgGetPeersTy
:
// Flag this peer as a 'requested of new peers' this to
...
...
@@ -398,6 +398,16 @@ func (p *Peer) HandleInbound() {
case
ethwire
.
MsgNotInChainTy
:
ethutil
.
Config
.
Log
.
Infof
(
"Not in chain %x
\n
"
,
msg
.
Data
)
// TODO
case
ethwire
.
MsgGetTxsTy
:
// Get the current transactions of the pool
txs
:=
p
.
ethereum
.
TxPool
()
.
CurrentTransactions
()
// Get the RlpData values from the txs
txsInterface
:=
make
([]
interface
{},
len
(
txs
))
for
i
,
tx
:=
range
txs
{
txsInterface
[
i
]
=
tx
.
RlpData
()
}
// Broadcast it back to the peer
p
.
QueueMessage
(
ethwire
.
NewMessage
(
ethwire
.
MsgTxTy
,
txsInterface
))
// Unofficial but fun nonetheless
case
ethwire
.
MsgTalkTy
:
...
...
@@ -562,6 +572,10 @@ func (p *Peer) CatchupWithPeer() {
p
.
QueueMessage
(
msg
)
ethutil
.
Config
.
Log
.
Debugf
(
"Requesting blockchain %x...
\n
"
,
p
.
ethereum
.
BlockChain
()
.
CurrentBlock
.
Hash
()[
:
4
])
msg
=
ethwire
.
NewMessage
(
ethwire
.
MsgGetTxsTy
,
[]
interface
{}{})
p
.
QueueMessage
(
msg
)
ethutil
.
Config
.
Log
.
Debugln
(
"Requested transactions"
)
}
}
...
...
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