fix: POST request of prove sending tx

This commit is contained in:
moneroexamples 2017-01-18 20:15:15 +08:00
parent 3e32a26cdf
commit 4809e3f972
2 changed files with 10 additions and 11 deletions

View File

@ -190,7 +190,7 @@ int main(int ac, const char* av[]) {
|| post_body.count("viewkey") == 0 || post_body.count("viewkey") == 0
|| post_body.count("tx_hash") == 0) || post_body.count("tx_hash") == 0)
{ {
return string("xmr_address, viewkey or tx_hash not provided"); return string("xmr address, viewkey or tx hash not provided");
} }
string tx_hash = post_body["tx_hash"]; string tx_hash = post_body["tx_hash"];
@ -205,21 +205,20 @@ int main(int ac, const char* av[]) {
map<std::string, std::string> post_body = xmreg::parse_crow_post_data(req.body); map<std::string, std::string> post_body = xmreg::parse_crow_post_data(req.body);
if (post_body.count("xmr_address") == 0 if (post_body.count("xmraddress") == 0
|| post_body.count("txprvkey") == 0 || post_body.count("txprvkey") == 0
|| post_body.count("tx_hash") == 0) || post_body.count("txhash") == 0)
{ {
return string("xmr_address, txprvkey or tx_hash not provided"); return string("xmr address, tx private key or tx hash not provided");
} }
string tx_hash = post_body["tx_hash"];; string tx_hash = post_body["txhash"];;
string tx_prv_key = post_body["txprvkey"];; string tx_prv_key = post_body["txprvkey"];;
string xmr_address = post_body["xmr_address"];; string xmr_address = post_body["xmraddress"];;
return xmrblocks.show_prove(tx_hash, xmr_address, tx_prv_key); return xmrblocks.show_prove(tx_hash, xmr_address, tx_prv_key);
}); });
CROW_ROUTE(app, "/rawtx") CROW_ROUTE(app, "/rawtx")
([&](const crow::request& req) { ([&](const crow::request& req) {
return xmrblocks.show_rawtx(); return xmrblocks.show_rawtx();

View File

@ -86,7 +86,7 @@
<h5 style="margin: 0px"> <h5 style="margin: 0px">
For RingCT transactions, outputs' amounts are also decoded For RingCT transactions, outputs' amounts are also decoded
<br/> <br/>
Note: address and viewkey are sent to server, as the calculations are done on the server side Note: address and viewkey are sent to the server, as the calculations are done on the server side
</h5> </h5>
<form action="/myoutputs" method="post" style="width:100%; margin-top:2px" class="style-1"> <form action="/myoutputs" method="post" style="width:100%; margin-top:2px" class="style-1">
<input type="hidden" name="tx_hash" value="{{tx_hash}}"><br/> <input type="hidden" name="tx_hash" value="{{tx_hash}}"><br/>
@ -107,12 +107,12 @@
Tx private key can be obtained using <i>get_tx_key</i> Tx private key can be obtained using <i>get_tx_key</i>
command in <i>monero-wallet-cli</i> command line tool command in <i>monero-wallet-cli</i> command line tool
<br/> <br/>
Note: address and tx private key are sent to server, as the calculations are done on the server side Note: address and tx private key are sent to the server, as the calculations are done on the server side
</h5> </h5>
<form action="/prove" method="post" style="width:100%;margin-top:2px" class="style-1"> <form action="/prove" method="post" style="width:100%;margin-top:2px" class="style-1">
<input type="hidden" name="tx_hash" value="{{tx_hash}}"><br/> <input type="hidden" name="txhash" value="{{tx_hash}}"><br/>
<input type="text" name="txprvkey" size="90" placeholder="Tx private key"><br/> <input type="text" name="txprvkey" size="90" placeholder="Tx private key"><br/>
<input type="text" name="xmr_address" size="90" placeholder="Recipient's Monero Address" style="margin-top:5px"><br/> <input type="text" name="xmraddress" size="90" placeholder="Recipient's Monero Address" style="margin-top:5px"><br/>
<input type="submit" value="Prove" style="margin-top:5px"> <input type="submit" value="Prove" style="margin-top:5px">
</form> </form>
</div> </div>