Start starts the chain by step: 1. sync the chain 2. goroutine for getting blocks 3. goroutine for getting txes.
()
| 326 | // 2. goroutine for getting blocks |
| 327 | // 3. goroutine for getting txes. |
| 328 | func (c *Chain) Start() { |
| 329 | // Start blocks/txs processing goroutines |
| 330 | c.goFunc(c.processBlocks) |
| 331 | c.goFunc(c.processTxs) |
| 332 | // Synchronize heads to current block period |
| 333 | c.syncHeads() |
| 334 | // TODO(leventeliu): subscribe ChainBus. |
| 335 | // ... |
| 336 | // Start main cycle and service |
| 337 | c.goFunc(c.mainCycle) |
| 338 | c.startService(c) |
| 339 | } |
| 340 | |
| 341 | // Stop stops the main process of the sql-chain. |
| 342 | func (c *Chain) Stop() (err error) { |