| 662 | } |
| 663 | |
| 664 | Value startcontracttpstest(const Array& params, bool fHelp) { |
| 665 | if (fHelp || params.size() != 3) { |
| 666 | throw runtime_error( |
| 667 | "startcontracttpstest \"regid\" \"period\" \"batch_size\"\n" |
| 668 | "\nStart generation blocks with batch_size contract transactions in period ms.\n" |
| 669 | "\nArguments:\n" |
| 670 | "1.\"regid\" (string, required) contract regid\n" |
| 671 | "2.\"period\" (numeric, required) 0~1000\n" |
| 672 | "3.\"batch_size\" (numeric, required)\n" |
| 673 | "\nResult:\n" |
| 674 | "\nExamples:\n" + |
| 675 | HelpExampleCli("startcontracttpstest", "\"3-1\" 20 20") + "\nAs json rpc call\n" + |
| 676 | HelpExampleRpc("startcontracttpstest", "\"3-1\", 20, 20")); |
| 677 | } |
| 678 | |
| 679 | Object obj; |
| 680 | if (SysCfg().NetworkID() != REGTEST_NET) { |
| 681 | obj.push_back(Pair("msg", "regtest only.")); |
| 682 | return obj; |
| 683 | } |
| 684 | |
| 685 | string regid = params[0].get_str(); |
| 686 | if (regid.empty()) { |
| 687 | throw JSONRPCError(RPC_INVALID_PARAMETER, "regid should not be empty"); |
| 688 | } |
| 689 | |
| 690 | int64_t period = params[1].get_int64(); |
| 691 | if (period < 0 || period > 1000) { |
| 692 | throw JSONRPCError(RPC_INVALID_PARAMETER, "period should range between 0 to 1000"); |
| 693 | } |
| 694 | |
| 695 | int64_t batchSize = params[2].get_int64(); |
| 696 | if (batchSize < 0) { |
| 697 | throw JSONRPCError(RPC_INVALID_PARAMETER, "batch size should be bigger than 0"); |
| 698 | } |
| 699 | |
| 700 | StartContractGeneration(regid, period, batchSize); |
| 701 | |
| 702 | obj.push_back(Pair("msg", "success")); |
| 703 | return obj; |
| 704 | } |
| 705 | |
| 706 | |
| 707 |
nothing calls this directly
no test coverage detected