added fork_version and updated mymonero-core-js

pull/135/head
moneroexamples 5 years ago
parent d1d6776fda
commit 260f565749

@ -11,8 +11,7 @@
"_comment" : "if paths are empty, default Monero paths will be used", "_comment" : "if paths are empty, default Monero paths will be used",
"mainnet" : "", "mainnet" : "",
"testnet" : "", "testnet" : "",
"stagenet2" : "", "stagenet" : "",
"stagenet" : "/home/mwo2/stagenet/node_01/stagenet/lmdb"
}, },
"database" : "database" :
{ {

@ -48,7 +48,9 @@ class HostedMoneroAPIClient
).catch( ).catch(
function(data) function(data)
{ {
fn(data && data.data.Error ? data.data.Error : "Something went wrong with getting your available balance for spending"); fn(data && data.data.Error
? data.data.Error
: "Something went wrong with getting your available balance for spending");
} }
); );
const requestHandle = const requestHandle =
@ -72,7 +74,10 @@ class HostedMoneroAPIClient
).catch( ).catch(
function(data) function(data)
{ {
fn(data && data.data.Error ? data.data.Error : "Something went wrong while getting decoy outputs"); fn(data
&& data.data.Error
? data.data.Error
: "Something went wrong while getting decoy outputs");
} }
); );
const requestHandle = const requestHandle =
@ -96,7 +101,10 @@ class HostedMoneroAPIClient
).catch( ).catch(
function(data) function(data)
{ {
fn(data && data.data.Error ? data.data.Error : "Something went wrong while submitting your transaction"); //console.log("submit_raw_data_error:", data);
fn(data && data.data.Error
? data.data.Error
: "Something went wrong while submitting your transaction");
} }
); );
const requestHandle = const requestHandle =

File diff suppressed because one or more lines are too long

@ -74,12 +74,24 @@ CurrentBlockchainStatus::get_current_blockchain_height()
return current_height; return current_height;
} }
uint64_t
CurrentBlockchainStatus::get_hard_fork_version() const
{
auto future_result = thread_pool->submit(
[this](auto current_height)
{
return this->mcore
->get_hard_fork_version(
current_height);
}, current_height.load());
return future_result.get();
}
void void
CurrentBlockchainStatus::update_current_blockchain_height() CurrentBlockchainStatus::update_current_blockchain_height()
{ {
//current_height = mcore->get_current_blockchain_height() - 1;
uint64_t tmp {0}; uint64_t tmp {0};
// This rpc call not only gets the blockchain height // This rpc call not only gets the blockchain height

@ -70,6 +70,9 @@ public:
virtual uint64_t virtual uint64_t
get_current_blockchain_height(); get_current_blockchain_height();
virtual uint64_t
get_hard_fork_version() const;
virtual void virtual void
update_current_blockchain_height(); update_current_blockchain_height();

@ -569,6 +569,8 @@ OpenMoneroRequests::get_unspent_outs(
j_response = json { j_response = json {
{"amount" , "0"}, // total value of the outputs {"amount" , "0"}, // total value of the outputs
{"fork_version",
current_bc_status->get_hard_fork_version()},
{"outputs", json::array()} // list of outputs {"outputs", json::array()} // list of outputs
// exclude those without require // exclude those without require
// no of confirmation // no of confirmation
@ -908,13 +910,13 @@ OpenMoneroRequests::submit_raw_tx(
if(!epee::string_tools::parse_hexstr_to_binbuff(raw_tx_blob, tx_blob)) if(!epee::string_tools::parse_hexstr_to_binbuff(raw_tx_blob, tx_blob))
{ {
j_response["status"] = "error"; error_msg = "Tx faild parse_hexstr_to_binbuff";
j_response["Error"] = "Tx faild parse_hexstr_to_binbuff";
OMERROR << j_response["Error"]; OMERROR << error_msg;
session_close(session, j_response, session_close(session, j_response,
UNPROCESSABLE_ENTITY); UNPROCESSABLE_ENTITY,
error_msg);
return; return;
} }
@ -922,28 +924,28 @@ OpenMoneroRequests::submit_raw_tx(
if (!parse_and_validate_tx_from_blob(tx_blob, tx_to_be_submitted)) if (!parse_and_validate_tx_from_blob(tx_blob, tx_to_be_submitted))
{ {
j_response["status"] = "error"; error_msg = "Tx faild parse_and_validate_tx_from_blob";
j_response["Error"] = "Tx faild parse_and_validate_tx_from_blob";
OMERROR << j_response["Error"]; OMERROR << error_msg;
session_close(session, j_response, session_close(session, j_response,
UNPROCESSABLE_ENTITY); UNPROCESSABLE_ENTITY,
error_msg);
return; return;
} }
if (current_bc_status->find_key_images_in_mempool(tx_to_be_submitted)) if (current_bc_status->find_key_images_in_mempool(tx_to_be_submitted))
{ {
j_response["status"] = "error"; error_msg = "Tx uses your outputs that area already "
j_response["Error"] = "Tx uses your outputs that area already "
"in the mempool. " "in the mempool. "
"Please wait till your previous tx(s) " "Please wait till your previous tx(s) "
"get mined"; "get mined";
OMERROR << j_response["Error"]; OMERROR << error_msg;
session_close(session, j_response, session_close(session, j_response,
UNPROCESSABLE_ENTITY); UNPROCESSABLE_ENTITY,
error_msg);
return; return;
} }
@ -951,18 +953,14 @@ OpenMoneroRequests::submit_raw_tx(
raw_tx_blob, error_msg, raw_tx_blob, error_msg,
current_bc_status->get_bc_setup().do_not_relay)) current_bc_status->get_bc_setup().do_not_relay))
{ {
j_response["status"] = "error"; OMERROR << error_msg;
j_response["Error"] = error_msg;
OMERROR << j_response["Error"];
session_close(session, j_response, session_close(session, j_response,
UNPROCESSABLE_ENTITY); UNPROCESSABLE_ENTITY,
error_msg);
return; return;
} }
j_response["status"] = "success";
string response_body = j_response.dump(); string response_body = j_response.dump();

@ -1 +1 @@
Subproject commit 298482324c2c56992fbeb55e35146acc935d8deb Subproject commit 9562666a598b52b8f3c12cbedc73e79398f1599b
Loading…
Cancel
Save