aboutsummaryrefslogtreecommitdiffstats
path: root/peer.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-03-28 18:20:07 +0800
committerobscuren <geffobscura@gmail.com>2014-03-28 18:20:07 +0800
commitb888652201277ab86e9e8c280e75e23ced5e3d38 (patch)
tree3685b52bf1d738a8b2167876295aa1a0db29b34e /peer.go
parent60fd2f3521471b300107847271f4df2919f1b0d4 (diff)
downloadgo-tangerine-b888652201277ab86e9e8c280e75e23ced5e3d38.tar
go-tangerine-b888652201277ab86e9e8c280e75e23ced5e3d38.tar.gz
go-tangerine-b888652201277ab86e9e8c280e75e23ced5e3d38.tar.bz2
go-tangerine-b888652201277ab86e9e8c280e75e23ced5e3d38.tar.lz
go-tangerine-b888652201277ab86e9e8c280e75e23ced5e3d38.tar.xz
go-tangerine-b888652201277ab86e9e8c280e75e23ced5e3d38.tar.zst
go-tangerine-b888652201277ab86e9e8c280e75e23ced5e3d38.zip
Added missing GetTx (0x16) wire message
Diffstat (limited to 'peer.go')
-rw-r--r--peer.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/peer.go b/peer.go
index 82c983927..279b0bc7f 100644
--- a/peer.go
+++ b/peer.go
@@ -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")
}
}