MCPcopy Create free account
hub / github.com/hyperledger/fabric / handleMessage

Method handleMessage

core/chaincode/handler.go:164–183  ·  view source on GitHub ↗

handleMessage is called by ProcessStream to dispatch messages.

(msg *pb.ChaincodeMessage)

Source from the content-addressed store, hash-verified

162
163// handleMessage is called by ProcessStream to dispatch messages.
164func (h *Handler) handleMessage(msg *pb.ChaincodeMessage) error {
165 h.stateLock.RLock()
166 state := h.state
167 h.stateLock.RUnlock()
168
169 chaincodeLogger.Debugf("[%s] Fabric side handling ChaincodeMessage of type: %s in state %s", shorttxid(msg.Txid), msg.Type, state)
170
171 if msg.Type == pb.ChaincodeMessage_KEEPALIVE {
172 return nil
173 }
174
175 switch state {
176 case Created:
177 return h.handleMessageCreatedState(msg)
178 case Ready:
179 return h.handleMessageReadyState(msg)
180 default:
181 return errors.Errorf("handle message: invalid state %s for transaction %s", state, msg.Txid)
182 }
183}
184
185func (h *Handler) handleMessageCreatedState(msg *pb.ChaincodeMessage) error {
186 switch msg.Type {

Callers 1

ProcessStreamMethod · 0.95

Calls 5

DebugfMethod · 0.80
shorttxidFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected