MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / nonblockingBroadcastTx

Method nonblockingBroadcastTx

blockproducer/chain_gossip.go:57–82  ·  view source on GitHub ↗
(ttl uint32, tx pi.Transaction)

Source from the content-addressed store, hash-verified

55}
56
57func (c *Chain) nonblockingBroadcastTx(ttl uint32, tx pi.Transaction) {
58 for _, info := range c.getRemoteBPInfos() {
59 func(remote *blockProducerInfo) {
60 c.goFuncWithTimeout(func(ctx context.Context) {
61 var (
62 req = &types.AddTxReq{
63 Envelope: proto.Envelope{
64 // TODO(lambda): Add fields.
65 },
66 TTL: ttl,
67 Tx: tx,
68 }
69 err = c.caller.CallNodeWithContext(
70 ctx, remote.nodeID, route.MCCAddTx.String(), req, nil)
71 )
72 log.WithFields(log.Fields{
73 "local": c.getLocalBPInfo(),
74 "remote": remote,
75 "hash": tx.Hash().Short(4),
76 "address": tx.GetAccountAddress(),
77 "type": tx.GetTransactionType(),
78 }).WithError(err).Debug("broadcast transaction to other peers")
79 }, c.tick)
80 }(info)
81 }
82}
83
84func (c *Chain) blockingFetchBlock(ctx context.Context, h uint32) (unreachable uint32) {
85 var (

Callers 1

processAddTxReqMethod · 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
HashMethod · 0.65
GetAccountAddressMethod · 0.65
GetTransactionTypeMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected