* 创建注册账户交易 * @param addr * @return */
| 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 | * 创建合约交易 |
nothing calls this directly
no test coverage detected