(block *types.BPBlock)
| 29 | ) |
| 30 | |
| 31 | func (c *Chain) nonblockingBroadcastBlock(block *types.BPBlock) { |
| 32 | for _, info := range c.getRemoteBPInfos() { |
| 33 | func(remote *blockProducerInfo) { |
| 34 | c.goFuncWithTimeout(func(ctx context.Context) { |
| 35 | var ( |
| 36 | req = &types.AdviseNewBlockReq{ |
| 37 | Envelope: proto.Envelope{ |
| 38 | // TODO(lambda): Add fields. |
| 39 | }, |
| 40 | Block: block, |
| 41 | } |
| 42 | err = c.caller.CallNodeWithContext( |
| 43 | ctx, remote.nodeID, route.MCCAdviseNewBlock.String(), req, nil) |
| 44 | ) |
| 45 | log.WithFields(log.Fields{ |
| 46 | "local": c.getLocalBPInfo(), |
| 47 | "remote": remote, |
| 48 | "block_time": block.Timestamp(), |
| 49 | "block_hash": block.BlockHash().Short(4), |
| 50 | "parent_hash": block.ParentHash().Short(4), |
| 51 | }).WithError(err).Debug("broadcast new block to other peers") |
| 52 | }, c.period) |
| 53 | }(info) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | func (c *Chain) nonblockingBroadcastTx(ttl uint32, tx pi.Transaction) { |
| 58 | for _, info := range c.getRemoteBPInfos() { |
no test coverage detected