(testCase TestCase, contract common.Address, testConext *TestContext)
| 165 | } |
| 166 | |
| 167 | func GenNeoVMTransaction(testCase TestCase, contract common.Address, testConext *TestContext) (*types.Transaction, error) { |
| 168 | params, err := utils2.ParseParams(testCase.Param) |
| 169 | if err != nil { |
| 170 | return nil, err |
| 171 | } |
| 172 | allParam := append([]interface{}{}, testCase.Method) |
| 173 | allParam = append(allParam, params...) |
| 174 | tx, err := common2.NewNeovmInvokeTransaction(0, 100000000, contract, allParam) |
| 175 | if err != nil { |
| 176 | return nil, err |
| 177 | } |
| 178 | |
| 179 | if testCase.NeedContext { |
| 180 | args := buildTestConextForNeo(testConext) |
| 181 | codelen := uint32(len(tx.Payload.(*payload.InvokeCode).Code)) |
| 182 | tx.Payload.(*payload.InvokeCode).Code = append(tx.Payload.(*payload.InvokeCode).Code[:codelen-(common.ADDR_LEN+1)], args...) |
| 183 | tx.Payload.(*payload.InvokeCode).Code = append(tx.Payload.(*payload.InvokeCode).Code, 0x67) |
| 184 | tx.Payload.(*payload.InvokeCode).Code = append(tx.Payload.(*payload.InvokeCode).Code, contract[:]...) |
| 185 | //neovms.Dumpcode(tx.Payload.(*payload.InvokeCode).Code[:], "") |
| 186 | } |
| 187 | |
| 188 | imt, err := tx.IntoImmutable() |
| 189 | if err != nil { |
| 190 | return nil, err |
| 191 | } |
| 192 | |
| 193 | imt.SignedAddr = append(imt.SignedAddr, testCase.Env.Witness...) |
| 194 | imt.SignedAddr = append(imt.SignedAddr, testConext.Admin) |
| 195 | |
| 196 | return imt, nil |
| 197 | } |
| 198 | |
| 199 | func buildTestConext(testConext *TestContext) []byte { |
| 200 | bf := common.NewZeroCopySink(nil) |
nothing calls this directly
no test coverage detected