MCPcopy Create free account
hub / github.com/33cn/chain33 / Send2Mempool

Method Send2Mempool

client/queueprotocol.go:119–143  ·  view source on GitHub ↗

Send2Mempool send transaction to mempool

(param *types.Transaction)

Source from the content-addressed store, hash-verified

117
118// Send2Mempool send transaction to mempool
119func (q *QueueProtocol) Send2Mempool(param *types.Transaction) (*types.Reply, error) {
120 if param == nil {
121 err := types.ErrInvalidParam
122 log.Error("SendTx", "Error", err)
123 return nil, err
124 }
125 msg, err := q.send(mempoolKey, types.EventTx, param)
126 if err != nil {
127 return nil, err
128 }
129 reply, ok := msg.GetData().(*types.Reply)
130 if ok {
131 if reply.GetIsOk() {
132 reply.Msg = param.Hash()
133 } else {
134 msg := string(reply.Msg)
135 err = fmt.Errorf(msg)
136 reply = nil
137 }
138 } else {
139 err = types.ErrTypeAsset
140 }
141 q.client.FreeMessage(msg)
142 return reply, err
143}
144
145func (q *QueueProtocol) send2MainChain(cfg *types.Chain33Config, tx *types.Transaction) (*types.Reply, error) {
146

Callers 1

SendTxMethod · 0.95

Calls 6

sendMethod · 0.95
ErrorMethod · 0.65
GetDataMethod · 0.65
HashMethod · 0.65
FreeMessageMethod · 0.65
GetIsOkMethod · 0.45

Tested by

no test coverage detected