(t *testing.T)
| 49 | } |
| 50 | |
| 51 | func TestStatelessValidator(t *testing.T) { |
| 52 | log.InitLog(log.InfoLog, log.Stdout) |
| 53 | acc := account.NewAccount("") |
| 54 | |
| 55 | code := []byte{1, 2, 3} |
| 56 | |
| 57 | mutable, err := utils.NewDeployTransaction(code, "test", "1", "author", "author@123.com", "test desp", payload.NEOVM_TYPE) |
| 58 | assert.Nil(t, err) |
| 59 | mutable.Payer = acc.Address |
| 60 | |
| 61 | signTransaction(acc, mutable) |
| 62 | |
| 63 | tx, err := mutable.IntoImmutable() |
| 64 | assert.Nil(t, err) |
| 65 | |
| 66 | validator := &validator{id: "test"} |
| 67 | props := actor.FromProducer(func() actor.Actor { |
| 68 | return validator |
| 69 | }) |
| 70 | |
| 71 | pid, err := actor.SpawnNamed(props, validator.id) |
| 72 | assert.Nil(t, err) |
| 73 | |
| 74 | msg := &types2.CheckTx{WorkerId: 1, Tx: tx} |
| 75 | fut := pid.RequestFuture(msg, time.Second) |
| 76 | |
| 77 | res, err := fut.Result() |
| 78 | assert.Nil(t, err) |
| 79 | |
| 80 | result := res.(*types2.CheckResponse) |
| 81 | assert.Equal(t, result.ErrCode, errors.ErrNoError) |
| 82 | assert.Equal(t, mutable.Hash(), result.Hash) |
| 83 | } |
nothing calls this directly
no test coverage detected