mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
use _tx_info.tx_blob instead of manually parsing json
https://github.com/moneroexamples/onion-monero-blockchain-explorer/issues/89
This commit is contained in:
parent
0186a57964
commit
e5f9a155c8
2 changed files with 48 additions and 54 deletions
|
@ -126,32 +126,21 @@ MempoolStatus::read_mempool()
|
|||
// get transaction info of the tx in the mempool
|
||||
const tx_info& _tx_info = mempool_tx_info.at(i);
|
||||
|
||||
crypto::hash mem_tx_hash = null_hash;
|
||||
|
||||
if (epee::string_tools::hex_to_pod(_tx_info.id_hash, mem_tx_hash))
|
||||
{
|
||||
transaction tx;
|
||||
crypto::hash tx_hash;
|
||||
crypto::hash tx_prefix_hash;
|
||||
|
||||
if (!xmreg::make_tx_from_json(_tx_info.tx_json, tx))
|
||||
if (!parse_and_validate_tx_from_blob(
|
||||
_tx_info.tx_blob, tx, tx_hash, tx_prefix_hash))
|
||||
{
|
||||
cerr << "Cant make tx from _tx_info.tx_json" << endl;
|
||||
cerr << "Cant make tx from _tx_info.tx_blob" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
crypto::hash tx_hash_reconstructed = get_transaction_hash(tx);
|
||||
|
||||
if (mem_tx_hash != tx_hash_reconstructed)
|
||||
{
|
||||
cerr << "Hash of reconstructed tx from json does not match "
|
||||
"what we should get!"
|
||||
<< endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
mempool_size_kB += _tx_info.blob_size;
|
||||
|
||||
local_copy_of_mempool_txs.push_back(mempool_tx {tx_hash_reconstructed, tx});
|
||||
local_copy_of_mempool_txs.push_back(mempool_tx {tx_hash, tx});
|
||||
|
||||
mempool_tx& last_tx = local_copy_of_mempool_txs.back();
|
||||
|
||||
|
@ -194,7 +183,7 @@ MempoolStatus::read_mempool()
|
|||
else if (payment_id8 != null_hash8)
|
||||
last_tx.pID = 'e'; // encrypted payment id
|
||||
|
||||
} // if (hex_to_pod(_tx_info.id_hash, mem_tx_hash))
|
||||
// } // if (hex_to_pod(_tx_info.id_hash, mem_tx_hash))
|
||||
|
||||
} // for (size_t i = 0; i < mempool_tx_info.size(); ++i)
|
||||
|
||||
|
|
|
@ -1203,7 +1203,7 @@ namespace xmreg
|
|||
}
|
||||
|
||||
|
||||
// cout << "\n\n j.dump()" << j.dump(4) << endl;
|
||||
cout << "\n\n j.dump()" << j.dump(4) << '\n';
|
||||
|
||||
// get version and unlock time from json
|
||||
tx.version = j["version"].get<size_t>();
|
||||
|
@ -1401,7 +1401,8 @@ namespace xmreg
|
|||
last_range_sig.asig = asig;
|
||||
|
||||
memcpy(&(last_range_sig.Ci), &(key64_contained.Ci), sizeof(rct::key64));
|
||||
}
|
||||
|
||||
} // for (json& range_s: j["rctsig_prunable"]["rangeSigs"])
|
||||
|
||||
vector<rct::mgSig>& mg_sigs = rctsig_prunable.MGs;
|
||||
|
||||
|
@ -1441,7 +1442,11 @@ namespace xmreg
|
|||
}
|
||||
|
||||
mg_sigs.push_back(new_mg_sig);
|
||||
}
|
||||
} // for (json& a_mgs: j["rctsig_prunable"]["MGs"])
|
||||
|
||||
//std::vector<Bulletproof>& bulletproof = rctsig_prunable.bulletproofs;
|
||||
|
||||
|
||||
|
||||
} // j.find("rctsig_prunable") != j.end()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue