added asset_type handling to TX outputs
This commit is contained in:
@@ -1504,7 +1504,7 @@ void BlockchainLMDB::open(const std::string& filename, const int db_flags)
|
||||
mdb_env_close(m_env);
|
||||
m_open = false;
|
||||
MFATAL("Existing lmdb database needs to be converted, which cannot be done on a read-only database.");
|
||||
MFATAL("Please run monerod once to convert the database.");
|
||||
MFATAL("Please run elbowd once to convert the database.");
|
||||
return;
|
||||
}
|
||||
// Note that there was a schema change within version 0 as well.
|
||||
|
||||
@@ -341,7 +341,7 @@ std::vector<std::string> DNSResolver::get_record(const std::string& url, int rec
|
||||
if (dnssec_available && !dnssec_valid)
|
||||
{
|
||||
MWARNING("Invalid DNSSEC " << get_record_name(record_type) << " record signature for " << url << ": " << result->why_bogus);
|
||||
MWARNING("Possibly your DNS service is problematic. You can have monerod use an alternate via env variable DNS_PUBLIC. Example: DNS_PUBLIC=tcp://9.9.9.9");
|
||||
MWARNING("Possibly your DNS service is problematic. You can have elbowd use an alternate via env variable DNS_PUBLIC. Example: DNS_PUBLIC=tcp://9.9.9.9");
|
||||
}
|
||||
if (result->havedata)
|
||||
{
|
||||
|
||||
@@ -89,10 +89,14 @@ namespace cryptonote
|
||||
txout_to_tagged_key(const crypto::public_key &_key, const crypto::view_tag &_view_tag) : key(_key), view_tag(_view_tag) { }
|
||||
crypto::public_key key;
|
||||
crypto::view_tag view_tag; // optimization to reduce scanning time
|
||||
std::string asset_type;
|
||||
uint64_t unlock_time;
|
||||
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
FIELD(key)
|
||||
FIELD(view_tag)
|
||||
FIELD(asset_type)
|
||||
FIELD(unlock_time)
|
||||
END_SERIALIZE()
|
||||
};
|
||||
|
||||
@@ -140,11 +144,13 @@ namespace cryptonote
|
||||
uint64_t amount;
|
||||
std::vector<uint64_t> key_offsets;
|
||||
crypto::key_image k_image; // double spending protection
|
||||
std::string asset_type;
|
||||
|
||||
BEGIN_SERIALIZE_OBJECT()
|
||||
VARINT_FIELD(amount)
|
||||
FIELD(key_offsets)
|
||||
FIELD(k_image)
|
||||
FIELD(asset_type)
|
||||
END_SERIALIZE()
|
||||
};
|
||||
|
||||
|
||||
@@ -930,6 +930,34 @@ namespace cryptonote
|
||||
: boost::optional<crypto::view_tag>();
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
bool get_output_asset_type(const cryptonote::tx_out& out, std::string& output_asset_type)
|
||||
{
|
||||
// after HF_VERSION_VIEW_TAGS, outputs with public keys are of type txout_to_tagged_key
|
||||
if (out.target.type() == typeid(txout_to_tagged_key))
|
||||
output_asset_type = boost::get< txout_to_tagged_key >(out.target).asset_type;
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unexpected output target type found: " << out.target.type().name());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
bool get_output_unlock_time(const cryptonote::tx_out& out, uint64_t& output_unlock_time)
|
||||
{
|
||||
// after HF_VERSION_VIEW_TAGS, outputs with public keys are of type txout_to_tagged_key
|
||||
if (out.target.type() == typeid(txout_to_tagged_key))
|
||||
output_unlock_time = boost::get< txout_to_tagged_key >(out.target).unlock_time;
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Unexpected output target type found: " << out.target.type().name());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
std::string short_hash_str(const crypto::hash& h)
|
||||
{
|
||||
std::string res = string_tools::pod_to_hex(h);
|
||||
@@ -939,7 +967,7 @@ namespace cryptonote
|
||||
return res;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
void set_tx_out(const uint64_t amount, const crypto::public_key& output_public_key, const bool use_view_tags, const crypto::view_tag& view_tag, tx_out& out)
|
||||
void set_tx_out(const uint64_t amount, const crypto::public_key& output_public_key, const bool use_view_tags, const crypto::view_tag& view_tag, const std::string& asset_type, const uint64_t unlock_time, tx_out& out)
|
||||
{
|
||||
out.amount = amount;
|
||||
if (use_view_tags)
|
||||
@@ -947,6 +975,8 @@ namespace cryptonote
|
||||
txout_to_tagged_key ttk;
|
||||
ttk.key = output_public_key;
|
||||
ttk.view_tag = view_tag;
|
||||
ttk.asset_type = asset_type;
|
||||
ttk.unlock_time = unlock_time;
|
||||
out.target = ttk;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace cryptonote
|
||||
void set_encrypted_payment_id_to_tx_extra_nonce(blobdata& extra_nonce, const crypto::hash8& payment_id);
|
||||
bool get_payment_id_from_tx_extra_nonce(const blobdata& extra_nonce, crypto::hash& payment_id);
|
||||
bool get_encrypted_payment_id_from_tx_extra_nonce(const blobdata& extra_nonce, crypto::hash8& payment_id);
|
||||
void set_tx_out(const uint64_t amount, const crypto::public_key& output_public_key, const bool use_view_tags, const crypto::view_tag& view_tag, tx_out& out);
|
||||
void set_tx_out(const uint64_t amount, const crypto::public_key& output_public_key, const bool use_view_tags, const crypto::view_tag& view_tag, const std::string& asset_type, const uint64_t unlock_time, tx_out& out);
|
||||
bool check_output_types(const transaction& tx, const uint8_t hf_version);
|
||||
bool out_can_be_to_acc(const boost::optional<crypto::view_tag>& view_tag_opt, const crypto::key_derivation& derivation, const size_t output_index, hw::device *hwdev = nullptr);
|
||||
bool is_out_to_acc(const account_keys& acc, const crypto::public_key& output_public_key, const crypto::public_key& tx_pub_key, const std::vector<crypto::public_key>& additional_tx_public_keys, size_t output_index, const boost::optional<crypto::view_tag>& view_tag_opt = boost::optional<crypto::view_tag>());
|
||||
@@ -131,6 +131,8 @@ namespace cryptonote
|
||||
uint64_t get_outs_money_amount(const transaction& tx);
|
||||
bool get_output_public_key(const cryptonote::tx_out& out, crypto::public_key& output_public_key);
|
||||
boost::optional<crypto::view_tag> get_output_view_tag(const cryptonote::tx_out& out);
|
||||
bool get_output_asset_type(const cryptonote::tx_out& out, std::string& output_asset_type);
|
||||
bool get_output_unlock_time(const cryptonote::tx_out& out, uint64_t& output_unlock_time);
|
||||
bool check_inputs_types_supported(const transaction& tx);
|
||||
bool check_outs_valid(const transaction& tx);
|
||||
bool parse_amount(uint64_t& amount, const std::string& str_amount);
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace cryptonote
|
||||
crypto::derive_view_tag(derivation, no, view_tag);
|
||||
|
||||
tx_out out;
|
||||
cryptonote::set_tx_out(amount, out_eph_public_key, use_view_tags, view_tag, out);
|
||||
cryptonote::set_tx_out(amount, out_eph_public_key, use_view_tags, view_tag, "" /* asset_type */, 0 /* unlock_time */, out);
|
||||
|
||||
tx.vout.push_back(out);
|
||||
}
|
||||
@@ -416,7 +416,7 @@ namespace cryptonote
|
||||
use_view_tags, view_tag);
|
||||
|
||||
tx_out out;
|
||||
cryptonote::set_tx_out(dst_entr.amount, out_eph_public_key, use_view_tags, view_tag, out);
|
||||
cryptonote::set_tx_out(dst_entr.amount, out_eph_public_key, use_view_tags, view_tag, "" /* asset_type */, 0 /* unlock_time */, out);
|
||||
tx.vout.push_back(out);
|
||||
output_index++;
|
||||
summary_outs_money += dst_entr.amount;
|
||||
|
||||
@@ -2951,7 +2951,7 @@ skip:
|
||||
m_core.set_target_blockchain_height(target);
|
||||
if (target == 0 && context.m_state > cryptonote_connection_context::state_before_handshake && !m_stopping)
|
||||
{
|
||||
MCWARNING("global", "monerod is now disconnected from the network");
|
||||
MCWARNING("global", "elbowd is now disconnected from the network");
|
||||
m_ask_for_txpool_complement = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,5 +71,5 @@ target_link_libraries(daemon
|
||||
${Blocks})
|
||||
set_property(TARGET daemon
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monerod")
|
||||
OUTPUT_NAME "elbowd")
|
||||
install(TARGETS daemon DESTINATION bin)
|
||||
|
||||
@@ -969,10 +969,10 @@ bool t_command_parser_executor::prune_blockchain(const std::vector<std::string>&
|
||||
|
||||
if (args.empty() || args[0] != "confirm")
|
||||
{
|
||||
std::cout << "Warning: pruning from within monerod will not shrink the database file size." << std::endl;
|
||||
std::cout << "Warning: pruning from within elbowd will not shrink the database file size." << std::endl;
|
||||
std::cout << "Instead, parts of the file will be marked as free, so the file will not grow" << std::endl;
|
||||
std::cout << "until that newly free space is used up. If you want a smaller file size now," << std::endl;
|
||||
std::cout << "exit monerod and run monero-blockchain-prune (you will temporarily need more" << std::endl;
|
||||
std::cout << "exit elbowd and run monero-blockchain-prune (you will temporarily need more" << std::endl;
|
||||
std::cout << "disk space for the database conversion though). If you are OK with the database" << std::endl;
|
||||
std::cout << "file keeping the same size, re-run this command with the \"confirm\" parameter." << std::endl;
|
||||
return true;
|
||||
|
||||
@@ -1466,10 +1466,10 @@ bool t_rpc_command_executor::print_status()
|
||||
bool daemon_is_alive = m_rpc_client->check_connection();
|
||||
|
||||
if(daemon_is_alive) {
|
||||
tools::success_msg_writer() << "monerod is running";
|
||||
tools::success_msg_writer() << "elbowd is running";
|
||||
}
|
||||
else {
|
||||
tools::fail_msg_writer() << "monerod is NOT running";
|
||||
tools::fail_msg_writer() << "elbowd is NOT running";
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -502,7 +502,7 @@ static bool set_tx_outputs(const rct::keyV& output_public_keys, cryptonote::tran
|
||||
const std::size_t num_destinations = output_public_keys.size();
|
||||
unsigned_tx.vout.resize(num_destinations);
|
||||
for (std::size_t i = 0; i < num_destinations; ++i)
|
||||
cryptonote::set_tx_out(0, rct::rct2pk(output_public_keys[i]), false, crypto::view_tag{}, unsigned_tx.vout[i]);
|
||||
cryptonote::set_tx_out(0, rct::rct2pk(output_public_keys[i]), false, crypto::view_tag{}, "" /* asset_type */, 0 /* unlock_time */, unsigned_tx.vout[i]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -524,7 +524,7 @@ static bool set_tx_outputs_with_view_tags(
|
||||
"multisig signing protocol: internal error, view tag size mismatch.");
|
||||
unsigned_tx.vout.resize(num_destinations);
|
||||
for (std::size_t i = 0; i < num_destinations; ++i)
|
||||
cryptonote::set_tx_out(0, rct::rct2pk(output_public_keys[i]), true, view_tags[i], unsigned_tx.vout[i]);
|
||||
cryptonote::set_tx_out(0, rct::rct2pk(output_public_keys[i]), true, view_tags[i], "" /* asset_type */, 0 /* unlock_time */, unsigned_tx.vout[i]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user