mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
monerod can now sync from pruned blocks
If the peer (whether pruned or not itself) supports sending pruned blocks to syncing nodes, the pruned version will be sent along with the hash of the pruned data and the block weight. The original tx hashes can be reconstructed from the pruned txes and theur prunable data hash. Those hashes and the block weights are hashes and checked against the set of precompiled hashes, ensuring the data we received is the original data. It is currently not possible to use this system when not using the set of precompiled hashes, since block weights can not otherwise be checked for validity. This is off by default for now, and is enabled by --sync-pruned-blocks
This commit is contained in:
parent
d0d76f771a
commit
8330e772f1
30 changed files with 731 additions and 195 deletions
|
@ -160,7 +160,7 @@ string tx2str(const cryptonote::transaction& tx, const cryptonote::hash256& tx_h
|
|||
return ss.str();
|
||||
}*/
|
||||
|
||||
bool tests::proxy_core::handle_incoming_tx(const cryptonote::blobdata& tx_blob, cryptonote::tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay) {
|
||||
bool tests::proxy_core::handle_incoming_tx(const cryptonote::tx_blob_entry& tx_blob, cryptonote::tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay) {
|
||||
if (!keeped_by_block)
|
||||
return true;
|
||||
|
||||
|
@ -168,7 +168,13 @@ bool tests::proxy_core::handle_incoming_tx(const cryptonote::blobdata& tx_blob,
|
|||
crypto::hash tx_prefix_hash = null_hash;
|
||||
transaction tx;
|
||||
|
||||
if (!parse_and_validate_tx_from_blob(tx_blob, tx, tx_hash, tx_prefix_hash)) {
|
||||
if (tx_blob.prunable_hash != crypto::null_hash)
|
||||
{
|
||||
cerr << "WRONG TRANSACTION, pruned blob rejected" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parse_and_validate_tx_from_blob(tx_blob.blob, tx, tx_hash, tx_prefix_hash)) {
|
||||
cerr << "WRONG TRANSACTION BLOB, Failed to parse, rejected" << endl;
|
||||
return false;
|
||||
}
|
||||
|
@ -176,7 +182,7 @@ bool tests::proxy_core::handle_incoming_tx(const cryptonote::blobdata& tx_blob,
|
|||
cout << "TX " << endl << endl;
|
||||
cout << tx_hash << endl;
|
||||
cout << tx_prefix_hash << endl;
|
||||
cout << tx_blob.size() << endl;
|
||||
cout << tx_blob.blob.size() << endl;
|
||||
//cout << string_tools::buff_to_hex_nodelimer(tx_blob) << endl << endl;
|
||||
cout << obj_to_json_str(tx) << endl;
|
||||
cout << endl << "ENDTX" << endl;
|
||||
|
@ -184,7 +190,7 @@ bool tests::proxy_core::handle_incoming_tx(const cryptonote::blobdata& tx_blob,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool tests::proxy_core::handle_incoming_txs(const std::vector<blobdata>& tx_blobs, std::vector<tx_verification_context>& tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
|
||||
bool tests::proxy_core::handle_incoming_txs(const std::vector<tx_blob_entry>& tx_blobs, std::vector<tx_verification_context>& tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
|
||||
{
|
||||
tvc.resize(tx_blobs.size());
|
||||
size_t i = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue