MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / CreateRandTx

Method CreateRandTx

src/tests/pressure_tests.cpp:203–245  ·  view source on GitHub ↗

随机创建6000个交易

Source from the content-addressed store, hash-verified

201
202 //随机创建6000个交易
203 void CreateRandTx(int txCount) {
204 for (int i = 0; i < txCount; ++i) {
205 int nTxType = GetRandTxType();
206 switch(nTxType) {
207 case 1:
208// {
209// BOOST_CHECK(CreateRegAcctTx());
210// ++i;
211// }
212 --i;
213 break;
214 case 2:
215 {
216 map<string, string>::iterator iterSrcAddr = GetRandAddress();
217 map<string, string>::iterator iterDesAddr = GetRandAddress();
218 while(iterDesAddr->first == iterSrcAddr->first) {
219 iterDesAddr = GetRandAddress();
220 }
221 BOOST_CHECK(CreateCommonTx(iterSrcAddr->second, iterDesAddr->second));
222 }
223 break;
224 case 3:
225 {
226 BOOST_CHECK(CallContractTx());
227 }
228 break;
229 case 4:
230// {
231// string hash ="";
232// BOOST_CHECK(CreateRegScriptTx(true,hash));
233// }
234 --i;
235 break;
236 default:
237 assert(0);
238 }
239// cout << "create tx order:" << i << "type:" <<nTxType << endl;
240 //putchar('\b'); //将当前行全部清空,用以显示最新的进度条状态
241 if(0 != i) {
242 ShowProgress("create tx progress: ",(int)(((i+1)/(float)txCount) * 100));
243 }
244 }
245 }
246
247 bool DetectionAccount(uint64_t llFuelValue, uint64_t llFees) {
248 uint64_t freeValue(0);

Callers

nothing calls this directly

Calls 3

GetRandTxTypeFunction · 0.85
GetRandAddressFunction · 0.85
CallContractTxFunction · 0.85

Tested by

no test coverage detected