Send2Mempool send transaction to mempool
(param *types.Transaction)
| 117 | |
| 118 | // Send2Mempool send transaction to mempool |
| 119 | func (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 | |
| 145 | func (q *QueueProtocol) send2MainChain(cfg *types.Chain33Config, tx *types.Transaction) (*types.Reply, error) { |
| 146 |