mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
xmreg::make_tx_from_json started
This commit is contained in:
parent
66caaea4dd
commit
df57d2b203
4 changed files with 51 additions and 2 deletions
29
src/page.h
29
src/page.h
|
@ -4016,9 +4016,34 @@ private:
|
|||
}
|
||||
else
|
||||
{
|
||||
// @TODO make tx_info from json
|
||||
// if dont have tx_blob member, construct tx_info
|
||||
// if dont have tx_blob member, construct tx
|
||||
// from json obtained from the rpc call
|
||||
|
||||
for (size_t i = 0; i < mempool_txs.size(); ++i)
|
||||
{
|
||||
// get transaction info of the tx in the mempool
|
||||
tx_info _tx_info = mempool_txs.at(i);
|
||||
|
||||
crypto::hash mem_tx_hash = null_hash;
|
||||
|
||||
if (hex_to_pod(_tx_info.id_hash, mem_tx_hash))
|
||||
{
|
||||
// @TODO need to make this tx from _tx_info.tx_json
|
||||
transaction tx;
|
||||
|
||||
if (!xmreg::make_tx_from_json(_tx_info.tx_json, tx))
|
||||
{
|
||||
cerr << "Cant make tx from _tx_info.tx_json" << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tx_hash == mem_tx_hash)
|
||||
{
|
||||
found_txs.push_back(make_pair(_tx_info, tx));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return found_txs;
|
||||
|
|
|
@ -101,6 +101,7 @@ namespace xmreg
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
mempool_txs = res.transactions;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1013,5 +1013,25 @@ get_real_output_for_key_image(const key_image& ki,
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
make_tx_from_json(const string& json_str, transaction& tx)
|
||||
{
|
||||
|
||||
json j;
|
||||
|
||||
try
|
||||
{
|
||||
j = json::parse(json_str);
|
||||
}
|
||||
catch (std::invalid_argument& e)
|
||||
{
|
||||
cerr << "make_tx_from_json: cant parse json string: " << e.what() << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -275,6 +275,9 @@ get_real_output_for_key_image(const key_image& ki,
|
|||
uint64_t output_idx,
|
||||
public_key output_pub_key);
|
||||
|
||||
bool
|
||||
make_tx_from_json(const string& json_str, transaction& tx);
|
||||
|
||||
}
|
||||
|
||||
#endif //XMREG01_TOOLS_H
|
||||
|
|
Loading…
Reference in a new issue