aboutsummaryrefslogtreecommitdiffstats
path: root/peer.go
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-04-01 20:20:55 +0800
committerMaran <maran.hidskes@gmail.com>2014-04-01 20:20:55 +0800
commit0a8801082676d64f904cbb5b62c1159e0bbd7788 (patch)
tree05e9c4ea80d5e01cca53d583318f43606418a19e /peer.go
parent5f49a659c36dbfb8c330ddc3d4565c19a9a936b5 (diff)
parent7277c420479239fbea78417e42c43ee0162c2728 (diff)
downloadgo-tangerine-0a8801082676d64f904cbb5b62c1159e0bbd7788.tar.gz
go-tangerine-0a8801082676d64f904cbb5b62c1159e0bbd7788.tar.zst
go-tangerine-0a8801082676d64f904cbb5b62c1159e0bbd7788.zip
Merge conflicts
Diffstat (limited to 'peer.go')
-rw-r--r--peer.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/peer.go b/peer.go
index 21d55ce6d..f2267c29b 100644
--- a/peer.go
+++ b/peer.go
@@ -396,7 +396,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()))
+ 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
@@ -462,6 +463,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:
@@ -649,7 +660,11 @@ func (p *Peer) CatchupWithPeer(blockHash []byte) {
msg := ethwire.NewMessage(ethwire.MsgGetChainTy, []interface{}{blockHash, uint64(50)})
p.QueueMessage(msg)
- ethutil.Config.Log.Debugf("Requesting blockchain %x...\n", blockHash[:4])
+ 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")
}
}