syncTransactions starts sending all currently pending transactions to the given peer.
(p *peer)
| 50 | |
| 51 | // syncTransactions starts sending all currently pending transactions to the given peer. |
| 52 | func (pm *ProtocolManager) syncTransactions(p *peer) { |
| 53 | var txs types.Transactions |
| 54 | pending, _ := pm.txpool.Pending() |
| 55 | log.Debug("syncTransactions pending", "len", len(pending), "peer", p.RemoteAddr().String()) |
| 56 | for _, batch := range pending { |
| 57 | txs = append(txs, batch...) |
| 58 | } |
| 59 | if len(txs) == 0 { |
| 60 | return |
| 61 | } |
| 62 | select { |
| 63 | case pm.txsyncCh <- &txsync{p, txs}: |
| 64 | case <-pm.quitSync: |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | // txsyncLoop takes care of the initial transaction sync for each new |
| 69 | // connection. When a new peer appears, we relay all currently pending |
no test coverage detected