diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-11 18:40:12 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-11 18:40:12 +0800 |
commit | cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007 (patch) | |
tree | ab28c518bd1b78f6b8ac8b241951ad161cb268a9 /eth/protocol.go | |
parent | 21fd31dad8bc6e0291ca405314b516670333c707 (diff) | |
parent | c6af5f0a275608ea6c797ef826e6090885f24eac (diff) | |
download | go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.gz go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.bz2 go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.lz go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.xz go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.tar.zst go-tangerine-cfddb7f3cd3b8cecb1e59412ce4db5769f6c8007.zip |
Merge branch 'develop' into jsonrpc
Conflicts:
rpc/ws/server.go
Diffstat (limited to 'eth/protocol.go')
-rw-r--r-- | eth/protocol.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/eth/protocol.go b/eth/protocol.go index 24a0f0a8e..d7a7fa910 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -13,7 +13,7 @@ import ( ) const ( - ProtocolVersion = 51 + ProtocolVersion = 52 NetworkId = 0 ProtocolLength = uint64(8) ProtocolMaxMsgSize = 10 * 1024 * 1024 @@ -46,6 +46,7 @@ type ethProtocol struct { // used as an argument to EthProtocol type txPool interface { AddTransactions([]*types.Transaction) + GetTransactions() types.Transactions } type chainManager interface { @@ -101,6 +102,7 @@ func runEthProtocol(txPool txPool, chainManager chainManager, blockPool blockPoo } err = self.handleStatus() if err == nil { + self.propagateTxs() for { err = self.handle() if err != nil { @@ -324,3 +326,13 @@ func (self *ethProtocol) protoErrorDisconnect(code int, format string, params .. } } + +func (self *ethProtocol) propagateTxs() { + transactions := self.txPool.GetTransactions() + iface := make([]interface{}, len(transactions)) + for i, transaction := range transactions { + iface[i] = transaction + } + + self.rw.WriteMsg(p2p.NewMsg(TxMsg, iface...)) +} |