MCPcopy Create free account
hub / github.com/DNAProject/DNA / Receive

Method Receive

validator/stateless/stateless_validator.go:60–90  ·  view source on GitHub ↗
(context actor.Context)

Source from the content-addressed store, hash-verified

58}
59
60func (self *validator) Receive(context actor.Context) {
61 switch msg := context.Message().(type) {
62 case *actor.Started:
63 log.Info("stateless-validator: started and be ready to receive txn")
64 case *actor.Stopping:
65 log.Info("stateless-validator: stopping")
66 case *actor.Restarting:
67 log.Info("stateless-validator: restarting")
68 case *actor.Stopped:
69 log.Info("stateless-validator: stopped")
70 case *vatypes.CheckTx:
71 log.Debugf("stateless-validator receive tx %x", msg.Tx.Hash())
72 sender := context.Sender()
73 errCode := validation.VerifyTransaction(msg.Tx)
74
75 response := &vatypes.CheckResponse{
76 WorkerId: msg.WorkerId,
77 ErrCode: errCode,
78 Hash: msg.Tx.Hash(),
79 Type: self.VerifyType(),
80 Height: 0,
81 }
82
83 sender.Tell(response)
84 case *vatypes.UnRegisterAck:
85 context.Self().Stop()
86 default:
87 log.Info("stateless-validator: unknown msg ", msg, "type", reflect.TypeOf(msg))
88 }
89
90}
91
92func (self *validator) VerifyType() vatypes.VerifyType {
93 return vatypes.Stateless

Callers

nothing calls this directly

Calls 7

VerifyTypeMethod · 0.95
InfoFunction · 0.92
DebugfFunction · 0.92
VerifyTransactionFunction · 0.92
SenderMethod · 0.80
HashMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected