(context actor.Context)
| 58 | } |
| 59 | |
| 60 | func (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 | |
| 92 | func (self *validator) VerifyType() vatypes.VerifyType { |
| 93 | return vatypes.Stateless |
nothing calls this directly
no test coverage detected