mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 13:18:53 +00:00
move checkpoints in a separate library
This commit is contained in:
parent
85f4b600d2
commit
5d65a75b69
@ -102,6 +102,7 @@ monero_add_library(version ${CMAKE_BINARY_DIR}/version.cpp)
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(crypto)
|
||||
add_subdirectory(ringct)
|
||||
add_subdirectory(checkpoints)
|
||||
add_subdirectory(cryptonote_basic)
|
||||
add_subdirectory(cryptonote_core)
|
||||
if(NOT IOS)
|
||||
|
@ -36,6 +36,7 @@ using namespace epee;
|
||||
|
||||
#include "common/dns_utils.h"
|
||||
#include "include_base_utils.h"
|
||||
#include "storages/portable_storage_template_helper.h" // epee json include
|
||||
#include <sstream>
|
||||
#include <random>
|
||||
|
||||
@ -51,7 +52,7 @@ namespace cryptonote
|
||||
//---------------------------------------------------------------------------
|
||||
bool checkpoints::add_checkpoint(uint64_t height, const std::string& hash_str)
|
||||
{
|
||||
crypto::hash h = null_hash;
|
||||
crypto::hash h = crypto::null_hash;
|
||||
bool r = epee::string_tools::parse_tpod_from_hex_string(hash_str, h);
|
||||
CHECK_AND_ASSERT_MES(r, false, "Failed to parse checkpoint hash string into binary representation!");
|
||||
|
@ -31,9 +31,9 @@
|
||||
#pragma once
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "cryptonote_basic_impl.h"
|
||||
#include "misc_log_ex.h"
|
||||
#include "storages/portable_storage_template_helper.h" // epee json include
|
||||
#include "crypto/hash.h"
|
||||
#include "serialization/keyvalue_serialization.h"
|
||||
|
||||
#define ADD_CHECKPOINT(h, hash) CHECK_AND_ASSERT(add_checkpoint(h, hash), false);
|
||||
#define JSON_HASH_FILE_NAME "checkpoints.json"
|
@ -31,12 +31,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/lock_guard.hpp>
|
||||
#include <boost/utility/value_init.hpp>
|
||||
#include <vector>
|
||||
|
||||
#include "common/pod-class.h"
|
||||
#include "generic-ops.h"
|
||||
#include "hex.h"
|
||||
#include "span.h"
|
||||
#include "hash.h"
|
||||
|
||||
namespace crypto {
|
||||
@ -248,6 +252,24 @@ namespace crypto {
|
||||
const signature *sig) {
|
||||
return check_ring_signature(prefix_hash, image, pubs.data(), pubs.size(), sig);
|
||||
}
|
||||
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::public_key &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::secret_key &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::key_derivation &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::key_image &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::signature &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
|
||||
const static crypto::public_key null_pkey = boost::value_initialized<crypto::public_key>();
|
||||
}
|
||||
|
||||
CRYPTO_MAKE_HASHABLE(public_key)
|
||||
|
@ -31,9 +31,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <iostream>
|
||||
#include <boost/utility/value_init.hpp>
|
||||
|
||||
#include "common/pod-class.h"
|
||||
#include "generic-ops.h"
|
||||
#include "hex.h"
|
||||
#include "span.h"
|
||||
|
||||
namespace crypto {
|
||||
|
||||
@ -75,6 +79,15 @@ namespace crypto {
|
||||
tree_hash(reinterpret_cast<const char (*)[HASH_SIZE]>(hashes), count, reinterpret_cast<char *>(&root_hash));
|
||||
}
|
||||
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::hash &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::hash8 &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
|
||||
const static crypto::hash null_hash = boost::value_initialized<crypto::hash>();
|
||||
const static crypto::hash8 null_hash8 = boost::value_initialized<crypto::hash8>();
|
||||
}
|
||||
|
||||
CRYPTO_MAKE_HASHABLE(hash)
|
||||
|
@ -34,7 +34,6 @@ endif()
|
||||
|
||||
set(cryptonote_basic_sources
|
||||
account.cpp
|
||||
checkpoints.cpp
|
||||
cryptonote_basic_impl.cpp
|
||||
cryptonote_format_utils.cpp
|
||||
difficulty.cpp
|
||||
@ -46,7 +45,6 @@ set(cryptonote_basic_headers)
|
||||
set(cryptonote_basic_private_headers
|
||||
account.h
|
||||
account_boost_serialization.h
|
||||
checkpoints.h
|
||||
connection_context.h
|
||||
cryptonote_basic.h
|
||||
cryptonote_basic_impl.h
|
||||
@ -69,6 +67,7 @@ target_link_libraries(cryptonote_basic
|
||||
PUBLIC
|
||||
common
|
||||
cncrypto
|
||||
checkpoints
|
||||
${Boost_DATE_TIME_LIBRARY}
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
${Boost_SERIALIZATION_LIBRARY}
|
||||
|
@ -40,7 +40,7 @@ namespace cryptonote
|
||||
struct cryptonote_connection_context: public epee::net_utils::connection_context_base
|
||||
{
|
||||
cryptonote_connection_context(): m_state(state_before_handshake), m_remote_blockchain_height(0), m_last_response_height(0),
|
||||
m_last_known_hash(cryptonote::null_hash) {}
|
||||
m_last_known_hash(crypto::null_hash) {}
|
||||
|
||||
enum state
|
||||
{
|
||||
|
@ -53,11 +53,6 @@
|
||||
|
||||
namespace cryptonote
|
||||
{
|
||||
|
||||
const static crypto::hash null_hash = AUTO_VAL_INIT(null_hash);
|
||||
const static crypto::hash8 null_hash8 = AUTO_VAL_INIT(null_hash8);
|
||||
const static crypto::public_key null_pkey = AUTO_VAL_INIT(null_pkey);
|
||||
|
||||
typedef std::vector<crypto::signature> ring_signature;
|
||||
|
||||
|
||||
|
@ -33,8 +33,6 @@
|
||||
#include "cryptonote_basic.h"
|
||||
#include "crypto/crypto.h"
|
||||
#include "crypto/hash.h"
|
||||
#include "hex.h"
|
||||
#include "span.h"
|
||||
|
||||
|
||||
namespace cryptonote {
|
||||
@ -136,26 +134,3 @@ namespace cryptonote {
|
||||
|
||||
bool parse_hash256(const std::string str_hash, crypto::hash& hash);
|
||||
|
||||
namespace crypto {
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::public_key &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::secret_key &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::key_derivation &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::key_image &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::signature &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::hash &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
inline std::ostream &operator <<(std::ostream &o, const crypto::hash8 &v) {
|
||||
epee::to_hex::formatted(o, epee::as_byte_span(v)); return o;
|
||||
}
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ namespace cryptonote
|
||||
// prunable rct
|
||||
if (t.rct_signatures.type == rct::RCTTypeNull)
|
||||
{
|
||||
hashes[2] = cryptonote::null_hash;
|
||||
hashes[2] = crypto::null_hash;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -49,7 +49,6 @@
|
||||
#include "common/boost_serialization_helper.h"
|
||||
#include "warnings.h"
|
||||
#include "crypto/hash.h"
|
||||
#include "cryptonote_basic/checkpoints.h"
|
||||
#include "cryptonote_core.h"
|
||||
#include "ringct/rctSigs.h"
|
||||
#include "common/perf_timer.h"
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include "cryptonote_tx_utils.h"
|
||||
#include "cryptonote_basic/verification_context.h"
|
||||
#include "crypto/hash.h"
|
||||
#include "cryptonote_basic/checkpoints.h"
|
||||
#include "checkpoints/checkpoints.h"
|
||||
#include "cryptonote_basic/hardfork.h"
|
||||
#include "blockchain_db/blockchain_db.h"
|
||||
|
||||
|
@ -45,7 +45,7 @@ using namespace epee;
|
||||
#include "misc_language.h"
|
||||
#include <csignal>
|
||||
#include <p2p/net_node.h>
|
||||
#include "cryptonote_basic/checkpoints.h"
|
||||
#include "checkpoints/checkpoints.h"
|
||||
#include "ringct/rctTypes.h"
|
||||
#include "blockchain_db/blockchain_db.h"
|
||||
#include "ringct/rctSigs.h"
|
||||
|
@ -340,7 +340,7 @@ size_t block_queue::get_num_filled_spans() const
|
||||
crypto::hash block_queue::get_last_known_hash(const boost::uuids::uuid &connection_id) const
|
||||
{
|
||||
boost::unique_lock<boost::recursive_mutex> lock(mutex);
|
||||
crypto::hash hash = cryptonote::null_hash;
|
||||
crypto::hash hash = crypto::null_hash;
|
||||
uint64_t highest_height = 0;
|
||||
for (const auto &span: blocks)
|
||||
{
|
||||
|
@ -1484,7 +1484,7 @@ skip:
|
||||
if (!start_from_current_chain)
|
||||
{
|
||||
// we'll want to start off from where we are on that peer, which may not be added yet
|
||||
if (context.m_last_known_hash != cryptonote::null_hash && r.block_ids.front() != context.m_last_known_hash)
|
||||
if (context.m_last_known_hash != crypto::null_hash && r.block_ids.front() != context.m_last_known_hash)
|
||||
r.block_ids.push_front(context.m_last_known_hash);
|
||||
}
|
||||
|
||||
|
@ -542,7 +542,7 @@ namespace rpc
|
||||
{
|
||||
if (m_core.get_current_blockchain_height() <= req.height)
|
||||
{
|
||||
res.hash = cryptonote::null_hash;
|
||||
res.hash = crypto::null_hash;
|
||||
res.status = Message::STATUS_FAILED;
|
||||
res.error_details = "height given is higher than current chain height";
|
||||
return;
|
||||
|
@ -3278,7 +3278,7 @@ bool simple_wallet::accept_loaded_tx(const std::function<size_t()> get_num_txes,
|
||||
|
||||
std::vector<tx_extra_field> tx_extra_fields;
|
||||
bool has_encrypted_payment_id = false;
|
||||
crypto::hash8 payment_id8 = cryptonote::null_hash8;
|
||||
crypto::hash8 payment_id8 = crypto::null_hash8;
|
||||
if (cryptonote::parse_tx_extra(cd.extra, tx_extra_fields))
|
||||
{
|
||||
tx_extra_nonce extra_nonce;
|
||||
|
@ -57,7 +57,7 @@ bool AddressBookImpl::addRow(const std::string &dst_addr , const std::string &pa
|
||||
return false;
|
||||
}
|
||||
|
||||
crypto::hash payment_id = cryptonote::null_hash;
|
||||
crypto::hash payment_id = crypto::null_hash;
|
||||
bool has_long_pid = (payment_id_str.empty())? false : tools::wallet2::parse_long_payment_id(payment_id_str, payment_id);
|
||||
|
||||
// Short payment id provided
|
||||
@ -106,7 +106,7 @@ void AddressBookImpl::refresh()
|
||||
for (size_t i = 0; i < rows.size(); ++i) {
|
||||
tools::wallet2::address_book_row * row = &rows.at(i);
|
||||
|
||||
std::string payment_id = (row->m_payment_id == cryptonote::null_hash)? "" : epee::string_tools::pod_to_hex(row->m_payment_id);
|
||||
std::string payment_id = (row->m_payment_id == crypto::null_hash)? "" : epee::string_tools::pod_to_hex(row->m_payment_id);
|
||||
std::string address = cryptonote::get_account_address_as_str(m_wallet->m_wallet->testnet(),row->m_address);
|
||||
// convert the zero padded short payment id to integrated address
|
||||
if (payment_id.length() > 16 && payment_id.substr(16).find_first_not_of('0') == std::string::npos) {
|
||||
|
@ -230,13 +230,13 @@ std::vector<std::string> UnsignedTransactionImpl::paymentId() const
|
||||
{
|
||||
std::vector<string> result;
|
||||
for (const auto &utx: m_unsigned_tx_set.txes) {
|
||||
crypto::hash payment_id = cryptonote::null_hash;
|
||||
crypto::hash payment_id = crypto::null_hash;
|
||||
cryptonote::tx_extra_nonce extra_nonce;
|
||||
std::vector<cryptonote::tx_extra_field> tx_extra_fields;
|
||||
cryptonote::parse_tx_extra(utx.extra, tx_extra_fields);
|
||||
if (cryptonote::find_tx_extra_field_by_type(tx_extra_fields, extra_nonce))
|
||||
{
|
||||
crypto::hash8 payment_id8 = cryptonote::null_hash8;
|
||||
crypto::hash8 payment_id8 = crypto::null_hash8;
|
||||
if(cryptonote::get_encrypted_payment_id_from_tx_extra_nonce(extra_nonce.nonce, payment_id8))
|
||||
{
|
||||
// We can't decrypt short pid without recipient key.
|
||||
@ -244,10 +244,10 @@ std::vector<std::string> UnsignedTransactionImpl::paymentId() const
|
||||
}
|
||||
else if (!cryptonote::get_payment_id_from_tx_extra_nonce(extra_nonce.nonce, payment_id))
|
||||
{
|
||||
payment_id = cryptonote::null_hash;
|
||||
payment_id = crypto::null_hash;
|
||||
}
|
||||
}
|
||||
if(payment_id != cryptonote::null_hash)
|
||||
if(payment_id != crypto::null_hash)
|
||||
result.push_back(epee::string_tools::pod_to_hex(payment_id));
|
||||
else
|
||||
result.push_back("");
|
||||
|
@ -3058,7 +3058,7 @@ crypto::hash wallet2::get_payment_id(const pending_tx &ptx) const
|
||||
{
|
||||
std::vector<tx_extra_field> tx_extra_fields;
|
||||
if(!parse_tx_extra(ptx.tx.extra, tx_extra_fields))
|
||||
return cryptonote::null_hash;
|
||||
return crypto::null_hash;
|
||||
tx_extra_nonce extra_nonce;
|
||||
crypto::hash payment_id = null_hash;
|
||||
if (find_tx_extra_field_by_type(tx_extra_fields, extra_nonce))
|
||||
@ -3073,7 +3073,7 @@ crypto::hash wallet2::get_payment_id(const pending_tx &ptx) const
|
||||
}
|
||||
else if (!get_payment_id_from_tx_extra_nonce(extra_nonce.nonce, payment_id))
|
||||
{
|
||||
payment_id = cryptonote::null_hash;
|
||||
payment_id = crypto::null_hash;
|
||||
}
|
||||
}
|
||||
return payment_id;
|
||||
@ -3122,7 +3122,7 @@ void wallet2::commit_tx(pending_tx& ptx)
|
||||
}
|
||||
|
||||
txid = get_transaction_hash(ptx.tx);
|
||||
crypto::hash payment_id = cryptonote::null_hash;
|
||||
crypto::hash payment_id = crypto::null_hash;
|
||||
std::vector<cryptonote::tx_destination_entry> dests;
|
||||
uint64_t amount_in = 0;
|
||||
if (store_tx_info())
|
||||
@ -5142,7 +5142,7 @@ crypto::public_key wallet2::get_tx_pub_key_from_received_outs(const tools::walle
|
||||
// we found no key yielding an output
|
||||
THROW_WALLET_EXCEPTION_IF(true, error::wallet_internal_error,
|
||||
"Public key yielding at least one output wasn't found in the transaction extra");
|
||||
return cryptonote::null_pkey;
|
||||
return crypto::null_pkey;
|
||||
}
|
||||
|
||||
bool wallet2::export_key_images(const std::string filename)
|
||||
|
@ -216,7 +216,7 @@ namespace tools
|
||||
uint64_t m_timestamp;
|
||||
uint64_t m_unlock_time;
|
||||
|
||||
confirmed_transfer_details(): m_amount_in(0), m_amount_out(0), m_change((uint64_t)-1), m_block_height(0), m_payment_id(cryptonote::null_hash), m_timestamp(0), m_unlock_time(0) {}
|
||||
confirmed_transfer_details(): m_amount_in(0), m_amount_out(0), m_change((uint64_t)-1), m_block_height(0), m_payment_id(crypto::null_hash), m_timestamp(0), m_unlock_time(0) {}
|
||||
confirmed_transfer_details(const unconfirmed_transfer_details &utd, uint64_t height):
|
||||
m_amount_in(utd.m_amount_in), m_amount_out(utd.m_amount_out), m_change(utd.m_change), m_block_height(height), m_dests(utd.m_dests), m_payment_id(utd.m_payment_id), m_timestamp(utd.m_timestamp), m_unlock_time(utd.m_tx.unlock_time) {}
|
||||
};
|
||||
|
@ -362,7 +362,7 @@ namespace tools
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool wallet_rpc_server::validate_transfer(const std::list<wallet_rpc::transfer_destination> destinations, std::string payment_id, std::vector<cryptonote::tx_destination_entry>& dsts, std::vector<uint8_t>& extra, epee::json_rpc::error& er)
|
||||
{
|
||||
crypto::hash8 integrated_payment_id = cryptonote::null_hash8;
|
||||
crypto::hash8 integrated_payment_id = crypto::null_hash8;
|
||||
std::string extra_nonce;
|
||||
for (auto it = destinations.begin(); it != destinations.end(); it++)
|
||||
{
|
||||
@ -395,7 +395,7 @@ namespace tools
|
||||
|
||||
if (has_payment_id)
|
||||
{
|
||||
if (!payment_id.empty() || integrated_payment_id != cryptonote::null_hash8)
|
||||
if (!payment_id.empty() || integrated_payment_id != crypto::null_hash8)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_WRONG_PAYMENT_ID;
|
||||
er.message = "A single payment id is allowed per transaction";
|
||||
@ -1485,7 +1485,7 @@ namespace tools
|
||||
cryptonote::account_public_address address;
|
||||
bool has_payment_id;
|
||||
crypto::hash8 payment_id8;
|
||||
crypto::hash payment_id = cryptonote::null_hash;
|
||||
crypto::hash payment_id = crypto::null_hash;
|
||||
er.message = "";
|
||||
if(!get_account_address_from_str_or_url(address, has_payment_id, payment_id8, m_wallet->testnet(), req.address,
|
||||
[&er](const std::string &url, const std::vector<std::string> &addresses, bool dnssec_valid)->std::string {
|
||||
|
@ -255,7 +255,7 @@ void tests::proxy_core::build_short_history(std::list<crypto::hash> &m_history,
|
||||
m_history.push_front(cit->first);
|
||||
|
||||
size_t n = 1 << m_history.size();
|
||||
while (m_hash2blkidx.end() != cit && cryptonote::null_hash != cit->second.blk.prev_id && n > 0) {
|
||||
while (m_hash2blkidx.end() != cit && crypto::null_hash != cit->second.blk.prev_id && n > 0) {
|
||||
n--;
|
||||
cit = m_hash2blkidx.find(cit->second.blk.prev_id);
|
||||
}
|
||||
@ -265,7 +265,7 @@ void tests::proxy_core::build_short_history(std::list<crypto::hash> &m_history,
|
||||
bool tests::proxy_core::add_block(const crypto::hash &_id, const crypto::hash &_longhash, const cryptonote::block &_blk, const cryptonote::blobdata &_blob) {
|
||||
size_t height = 0;
|
||||
|
||||
if (cryptonote::null_hash != _blk.prev_id) {
|
||||
if (crypto::null_hash != _blk.prev_id) {
|
||||
std::unordered_map<crypto::hash, tests::block_index>::const_iterator cit = m_hash2blkidx.find(_blk.prev_id);
|
||||
if (m_hash2blkidx.end() == cit) {
|
||||
cerr << "ERROR: can't find previous block with id \"" << _blk.prev_id << "\"" << endl;
|
||||
|
@ -46,7 +46,7 @@ namespace tests
|
||||
cryptonote::blobdata blob;
|
||||
std::list<cryptonote::transaction> txes;
|
||||
|
||||
block_index() : height(0), id(cryptonote::null_hash), longhash(cryptonote::null_hash) { }
|
||||
block_index() : height(0), id(crypto::null_hash), longhash(crypto::null_hash) { }
|
||||
block_index(size_t _height, const crypto::hash &_id, const crypto::hash &_longhash, const cryptonote::block &_blk, const cryptonote::blobdata &_blob, const std::list<cryptonote::transaction> &_txes)
|
||||
: height(_height), id(_id), longhash(_longhash), blk(_blk), blob(_blob), txes(_txes) { }
|
||||
};
|
||||
|
@ -486,7 +486,7 @@ bool gen_rct_tx_pre_rct_altered_extra::generate(std::vector<test_event_entry>& e
|
||||
const uint64_t amount_paid = 10000;
|
||||
bool failed = false;
|
||||
return generate_with(events, out_idx, mixin, amount_paid, false,
|
||||
NULL, [&failed](transaction &tx) {std::string extra_nonce; crypto::hash pid = cryptonote::null_hash; set_payment_id_to_tx_extra_nonce(extra_nonce, pid); if (!add_extra_nonce_to_tx_extra(tx.extra, extra_nonce)) failed = true; }) && !failed;
|
||||
NULL, [&failed](transaction &tx) {std::string extra_nonce; crypto::hash pid = crypto::null_hash; set_payment_id_to_tx_extra_nonce(extra_nonce, pid); if (!add_extra_nonce_to_tx_extra(tx.extra, extra_nonce)) failed = true; }) && !failed;
|
||||
}
|
||||
|
||||
bool gen_rct_tx_rct_altered_extra::generate(std::vector<test_event_entry>& events) const
|
||||
@ -496,6 +496,6 @@ bool gen_rct_tx_rct_altered_extra::generate(std::vector<test_event_entry>& event
|
||||
const uint64_t amount_paid = 10000;
|
||||
bool failed = false;
|
||||
return generate_with(events, out_idx, mixin, amount_paid, false,
|
||||
NULL, [&failed](transaction &tx) {std::string extra_nonce; crypto::hash pid = cryptonote::null_hash; set_payment_id_to_tx_extra_nonce(extra_nonce, pid); if (!add_extra_nonce_to_tx_extra(tx.extra, extra_nonce)) failed = true; }) && !failed;
|
||||
NULL, [&failed](transaction &tx) {std::string extra_nonce; crypto::hash pid = crypto::null_hash; set_payment_id_to_tx_extra_nonce(extra_nonce, pid); if (!add_extra_nonce_to_tx_extra(tx.extra, extra_nonce)) failed = true; }) && !failed;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
bool get_short_chain_history(std::list<crypto::hash>& ids) const { return true; }
|
||||
bool get_stat_info(cryptonote::core_stat_info& st_inf) const {return true;}
|
||||
bool have_block(const crypto::hash& id) const {return true;}
|
||||
void get_blockchain_top(uint64_t& height, crypto::hash& top_id)const{height=0;top_id=cryptonote::null_hash;}
|
||||
void get_blockchain_top(uint64_t& height, crypto::hash& top_id)const{height=0;top_id=crypto::null_hash;}
|
||||
bool handle_incoming_tx(const cryptonote::blobdata& tx_blob, cryptonote::tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay) { return true; }
|
||||
bool handle_incoming_txs(const std::list<cryptonote::blobdata>& tx_blob, std::vector<cryptonote::tx_verification_context>& tvc, bool keeped_by_block, bool relayed, bool do_not_relay) { return true; }
|
||||
bool handle_incoming_block(const cryptonote::blobdata& block_blob, cryptonote::block_verification_context& bvc, bool update_miner_blocktemplate = true) { return true; }
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "cryptonote_basic/checkpoints.cpp"
|
||||
#include "checkpoints/checkpoints.cpp"
|
||||
|
||||
using namespace cryptonote;
|
||||
|
||||
|
@ -42,7 +42,7 @@ static tools::wallet2::transfer_container make_transfers_container(size_t N)
|
||||
tools::wallet2::transfer_details &td = transfers.back();
|
||||
td.m_block_height = 1000;
|
||||
td.m_spent = false;
|
||||
td.m_txid = cryptonote::null_hash;
|
||||
td.m_txid = crypto::null_hash;
|
||||
td.m_txid.data[0] = n & 0xff;
|
||||
td.m_txid.data[1] = (n >> 8) & 0xff;
|
||||
td.m_txid.data[2] = (n >> 16) & 0xff;
|
||||
|
@ -141,7 +141,7 @@ TEST(parse_and_validate_tx_extra, is_valid_tx_extra_parsed)
|
||||
cryptonote::blobdata b = "dsdsdfsdfsf";
|
||||
ASSERT_TRUE(cryptonote::construct_miner_tx(0, 0, 10000000000000, 1000, TEST_FEE, acc.get_keys().m_account_address, tx, b, 1));
|
||||
crypto::public_key tx_pub_key = cryptonote::get_tx_pub_key_from_extra(tx);
|
||||
ASSERT_NE(tx_pub_key, cryptonote::null_pkey);
|
||||
ASSERT_NE(tx_pub_key, crypto::null_pkey);
|
||||
}
|
||||
TEST(parse_and_validate_tx_extra, fails_on_big_extra_nonce)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user