MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / nonblockingBroadcastBlock

Method nonblockingBroadcastBlock

blockproducer/chain_gossip.go:31–55  ·  view source on GitHub ↗
(block *types.BPBlock)

Source from the content-addressed store, hash-verified

29)
30
31func (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
57func (c *Chain) nonblockingBroadcastTx(ttl uint32, tx pi.Transaction) {
58 for _, info := range c.getRemoteBPInfos() {

Callers 1

produceBlockMethod · 0.95

Calls 12

getRemoteBPInfosMethod · 0.95
goFuncWithTimeoutMethod · 0.95
getLocalBPInfoMethod · 0.95
WithFieldsFunction · 0.92
CallNodeWithContextMethod · 0.80
DebugMethod · 0.80
WithErrorMethod · 0.80
ShortMethod · 0.80
StringMethod · 0.45
TimestampMethod · 0.45
BlockHashMethod · 0.45
ParentHashMethod · 0.45

Tested by

no test coverage detected