aboutsummaryrefslogtreecommitdiffstats
path: root/eth/protocol.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-13 22:05:56 +0800
committerobscuren <geffobscura@gmail.com>2015-02-13 22:05:56 +0800
commita5ea21cd85530eee6eb1bb83c37c20d009f11f74 (patch)
treee5be5bd595139ff7dfbe6261e1e659d8e7dd6f9c /eth/protocol.go
parentdb24fb792cf0dab91bc85e79aecf6758349002a4 (diff)
parent38faf2c51a1e4a86cda5dfa1b4f7fdae4fd7f58d (diff)
downloaddexon-a5ea21cd85530eee6eb1bb83c37c20d009f11f74.tar
dexon-a5ea21cd85530eee6eb1bb83c37c20d009f11f74.tar.gz
dexon-a5ea21cd85530eee6eb1bb83c37c20d009f11f74.tar.bz2
dexon-a5ea21cd85530eee6eb1bb83c37c20d009f11f74.tar.lz
dexon-a5ea21cd85530eee6eb1bb83c37c20d009f11f74.tar.xz
dexon-a5ea21cd85530eee6eb1bb83c37c20d009f11f74.tar.zst
dexon-a5ea21cd85530eee6eb1bb83c37c20d009f11f74.zip
merge
Diffstat (limited to 'eth/protocol.go')
-rw-r--r--eth/protocol.go14
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...))
+}