MCPcopy
hub / github.com/canopy-network/canopy / getStateMachineWithHeight

Method getStateMachineWithHeight

cmd/rpc/server.go:233–242  ·  view source on GitHub ↗

setupStateMachine creates and returns a read-only state machine

(height uint64, w http.ResponseWriter)

Source from the content-addressed store, hash-verified

231
232// setupStateMachine creates and returns a read-only state machine
233func (s *Server) getStateMachineWithHeight(height uint64, w http.ResponseWriter) (*fsm.StateMachine, bool) {
234
235 // Investigate memory use of state. State.Discard needs to be called
236 state, err := s.controller.FSM.TimeMachine(height)
237 if err != nil {
238 write(w, lib.ErrTimeMachine(err), http.StatusInternalServerError)
239 return nil, false
240 }
241 return state, true
242}
243
244// getFeeFromState populates txRequest with the fee for the transaction type specified in messageName
245func (s *Server) getFeeFromState(ptr *txRequest, messageName string, lockorder ...bool) lib.ErrorI {

Calls 3

ErrTimeMachineFunction · 0.92
writeFunction · 0.85
TimeMachineMethod · 0.80

Tested by

no test coverage detected