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

Method CreateCommonTx

src/tests/pressure_tests.cpp:89–114  ·  view source on GitHub ↗

* 创建普通交易 * @return */

Source from the content-addressed store, hash-verified

87 * @return
88 */
89 bool CreateCommonTx(string srcAddr, string desAddr) {
90 char fee[64] = {0};
91 int nfee = GetRandomFee();
92 sprintf(fee, "%d", nfee);
93 char money[64] = {0};
94 int nmoney = GetRandomMoney();
95 sprintf(money, "%d00000000", nmoney);
96 const char *argv[] = { "rpctest", "sendtoaddresswithfee", srcAddr.c_str(), desAddr.c_str(), money, fee};
97 int argc = sizeof(argv) / sizeof(char*);
98 Value value;
99 if (!CommandLineRPC_GetValue(argc, argv, value)) {
100 return false;
101 }
102 const Value& result = find_value(value.get_obj(), "txid");
103 if(result == null_type) {
104 return false;
105 }
106 string txid = result.get_str();
107 vTransactionHash.push_back(txid);
108 if (mempool.mapTx.count(uint256(uint256S(txid))) > 0) {
109 std::shared_ptr<CBaseTx> tx = mempool.mapTx[uint256(uint256S(txid))].GetTransaction();
110 vTransactions.push_back(tx);
111 }
112 vSendFee.push_back(make_pair(txid, nfee));
113 return true;
114 }
115 /**
116 * 创建注册账户交易
117 * @param addr

Callers

nothing calls this directly

Calls 6

CommandLineRPC_GetValueFunction · 0.85
uint256SFunction · 0.85
push_backMethod · 0.80
GetTransactionMethod · 0.80
uint256Class · 0.50
countMethod · 0.45

Tested by

no test coverage detected