mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 13:55:17 +00:00
spec/reactors/mempool: batch txs per peer (#155)
* spec/reactors/mempool: batch txs per peer Refs https://github.com/tendermint/tendermint/issues/625 * update
This commit is contained in:
@@ -2,25 +2,16 @@
|
||||
|
||||
## P2P Messages
|
||||
|
||||
There is currently only one message that Mempool broadcasts
|
||||
and receives over the p2p gossip network (via the reactor):
|
||||
`TxMessage`
|
||||
There is currently only one message that Mempool broadcasts and receives over
|
||||
the p2p gossip network (via the reactor): `TxsMessage`
|
||||
|
||||
```go
|
||||
// TxMessage is a MempoolMessage containing a transaction.
|
||||
type TxMessage struct {
|
||||
Tx types.Tx
|
||||
// TxsMessage is a MempoolMessage containing a list of transactions.
|
||||
type TxsMessage struct {
|
||||
Txs []types.Tx
|
||||
}
|
||||
```
|
||||
|
||||
TxMessage is go-amino encoded and prepended with `0x1` as a
|
||||
"type byte". This is followed by a go-amino encoded byte-slice.
|
||||
Prefix of 40=0x28 byte tx is: `0x010128...` followed by
|
||||
the actual 40-byte tx. Prefix of 350=0x015e byte tx is:
|
||||
`0x0102015e...` followed by the actual 350 byte tx.
|
||||
|
||||
(Please see the [go-amino repo](https://github.com/tendermint/go-amino#an-interface-example) for more information)
|
||||
|
||||
## RPC Messages
|
||||
|
||||
Mempool exposes `CheckTx([]byte)` over the RPC interface.
|
||||
|
||||
@@ -13,6 +13,11 @@ for details.
|
||||
Sending incorrectly encoded data or data exceeding `maxMsgSize` will result
|
||||
in stopping the peer.
|
||||
|
||||
`maxMsgSize` equals `MaxBatchBytes` (10MB) + 4 (proto overhead).
|
||||
`MaxBatchBytes` is a mempool config parameter -> defined locally. The reactor
|
||||
sends transactions to the connected peers in batches. The maximum size of one
|
||||
batch is `MaxBatchBytes`.
|
||||
|
||||
The mempool will not send a tx back to any peer which it received it from.
|
||||
|
||||
The reactor assigns an `uint16` number for each peer and maintains a map from
|
||||
|
||||
Reference in New Issue
Block a user