Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
b8886522
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b8886522
编写于
3月 28, 2014
作者:
O
obscuren
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added missing GetTx (0x16) wire message
上级
60fd2f35
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
3 deletion
+25
-3
ethchain/transaction_pool.go
ethchain/transaction_pool.go
+7
-1
ethwire/messaging.go
ethwire/messaging.go
+2
-0
peer.go
peer.go
+16
-2
未找到文件。
ethchain/transaction_pool.go
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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"
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录