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

Method CreateRegAcctTx

src/tests/pressure_tests.cpp:120–151  ·  view source on GitHub ↗

* 创建注册账户交易 * @param addr * @return */

Source from the content-addressed store, hash-verified

118 * @return
119 */
120 bool CreateRegAcctTx() {
121 //获取一个新的地址
122 const char *argv[] = {"rpctest", "getnewaddr"};
123 int argc = sizeof(argv) /sizeof(char *);
124 Value value;
125 if(!CommandLineRPC_GetValue(argc, argv, value))
126 {
127 return false;
128 }
129 const Value& retNewAddr = find_value(value.get_obj(), "addr");
130 if(retNewAddr.type() == null_type) {
131 return false;
132 }
133 string newAddress = retNewAddr.get_str();
134 map<string, string>::iterator iterSrcAddr = GetRandAddress();
135 //向新产生地址发送一笔钱
136 if(!CreateCommonTx(iterSrcAddr->second, newAddress))
137 return false;
138
139 int nfee = GetRandomFee() + 100000000;
140 Value result = RegisterAccountTx(newAddress, nfee);
141 string txid = "";
142 BOOST_CHECK(GetHashFromCreatedTx(value, txid));
143
144 vTransactionHash.push_back(txid);
145 if (mempool.mapTx.count(uint256(uint256S(txid))) > 0) {
146 std::shared_ptr<CBaseTx> tx = mempool.mapTx[uint256(uint256S(txid))].GetTransaction();
147 vTransactions.push_back(tx);
148 }
149 vSendFee.push_back(make_pair(txid, nfee));
150 return true;
151 }
152
153 /**
154 * 创建合约交易

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected