fixes to the CLI wallet output of staking and protocol_tx outputs
This commit is contained in:
@@ -154,20 +154,20 @@ struct Wallet2CallbackImpl : public tools::i_wallet2_callback
|
||||
}
|
||||
}
|
||||
|
||||
virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, uint64_t burnt, const cryptonote::subaddress_index& subaddr_index, bool is_change, uint64_t unlock_time)
|
||||
virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, const cryptonote::subaddress_index& subaddr_index, bool is_change, uint64_t unlock_time, const uint64_t& tx_origin_idx)
|
||||
{
|
||||
|
||||
std::string tx_hash = epee::string_tools::pod_to_hex(txid);
|
||||
|
||||
LOG_PRINT_L3(__FUNCTION__ << ": money received. height: " << height
|
||||
<< ", tx: " << tx_hash
|
||||
<< ", amount: " << print_money(amount - burnt)
|
||||
<< ", burnt: " << print_money(burnt)
|
||||
<< ", raw_output_value: " << print_money(amount)
|
||||
<< ", amount: " << print_money(amount)
|
||||
<< ", burnt: " << print_money(tx.amount_burnt)
|
||||
<< ", raw_output_value: " << print_money(amount - tx.amount_burnt)
|
||||
<< ", idx: " << subaddr_index);
|
||||
// do not signal on received tx if wallet is not syncronized completely
|
||||
if (m_listener && m_wallet->synchronized()) {
|
||||
m_listener->moneyReceived(tx_hash, amount - burnt);
|
||||
m_listener->moneyReceived(tx_hash, amount - tx.amount_burnt);
|
||||
m_listener->updated();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2101,6 +2101,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
||||
std::vector<tx_scan_info_t> tx_scan_info(tx.vout.size());
|
||||
std::deque<bool> output_found(tx.vout.size(), false);
|
||||
uint64_t total_received_1 = 0;
|
||||
uint64_t origin_td_idx = ((uint64_t)-1);
|
||||
while (!tx.vout.empty())
|
||||
{
|
||||
std::vector<size_t> outs;
|
||||
@@ -2252,6 +2253,9 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
||||
error::wallet_internal_error,
|
||||
"Failed to calculate uniqueness from origin TX");
|
||||
|
||||
// At this point, we know that we are receiving something - store the origin TD index
|
||||
origin_td_idx = idx;
|
||||
|
||||
// At this point, we need to clear the "locked coins" count, because otherwise we will be counting yield stakes twice in our balance
|
||||
|
||||
// Get the output key for the change entry
|
||||
@@ -2331,6 +2335,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
||||
td.m_txid = txid;
|
||||
td.m_asset_type_output_index = asset_type_output_indices[o];
|
||||
td.asset_type = asset_type;
|
||||
td.m_origin_td_idx = origin_td_idx;
|
||||
td.m_key_image = tx_scan_info[o].ki;
|
||||
td.m_key_image_known = !m_watch_only && !m_multisig;
|
||||
if (!td.m_key_image_known)
|
||||
@@ -2389,7 +2394,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
||||
}
|
||||
LOG_PRINT_L0("Received money: " << print_money(td.amount()) << ", with tx: " << txid);
|
||||
if (0 != m_callback)
|
||||
m_callback->on_money_received(height, txid, tx, td.m_amount, 0, td.asset_type, td.m_subaddr_index, spends_one_of_ours(tx), td.m_tx.unlock_time);
|
||||
m_callback->on_money_received(height, txid, tx, td.m_amount, td.asset_type, td.m_subaddr_index, spends_one_of_ours(tx), td.m_tx.unlock_time, td.m_origin_td_idx);
|
||||
}
|
||||
total_received_1 += amount;
|
||||
notify = true;
|
||||
@@ -2459,6 +2464,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
||||
THROW_WALLET_EXCEPTION_IF(!cryptonote::get_output_asset_type(tx.vout[o], asset_type), error::wallet_internal_error, "failed to get output_asset_type");
|
||||
td.m_asset_type_output_index = asset_type_output_indices[o];
|
||||
td.asset_type = asset_type;
|
||||
td.m_origin_td_idx = origin_td_idx;
|
||||
td.m_amount = amount;
|
||||
td.m_pk_index = pk_index - 1;
|
||||
td.m_subaddr_index = tx_scan_info[o].received->index;
|
||||
@@ -2493,7 +2499,7 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote
|
||||
|
||||
LOG_PRINT_L0("Received money: " << print_money(td.amount()) << ", with tx: " << txid);
|
||||
if (0 != m_callback)
|
||||
m_callback->on_money_received(height, txid, tx, td.m_amount, burnt, td.asset_type, td.m_subaddr_index, spends_one_of_ours(tx), td.m_tx.unlock_time);
|
||||
m_callback->on_money_received(height, txid, tx, td.m_amount, td.asset_type, td.m_subaddr_index, spends_one_of_ours(tx), td.m_tx.unlock_time, td.m_origin_td_idx);
|
||||
}
|
||||
total_received_1 += extra_amount;
|
||||
notify = true;
|
||||
@@ -13411,6 +13417,7 @@ size_t wallet2::import_outputs(const std::tuple<uint64_t, uint64_t, std::vector<
|
||||
td.m_key_image_partial = false;
|
||||
td.m_subaddr_index.major = etd.m_subaddr_index_major;
|
||||
td.m_subaddr_index.minor = etd.m_subaddr_index_minor;
|
||||
td.m_origin_td_idx = ((uint64_t)-1);
|
||||
|
||||
// skip those we've already imported, or which have different data
|
||||
if (i + offset < original_size)
|
||||
|
||||
@@ -140,7 +140,7 @@ private:
|
||||
// Full wallet callbacks
|
||||
virtual void on_new_block(uint64_t height, const cryptonote::block& block) {}
|
||||
virtual void on_reorg(uint64_t height, uint64_t blocks_detached, size_t transfers_detached) {}
|
||||
virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, uint64_t burnt, const std::string& asset_type, const cryptonote::subaddress_index& subaddr_index, bool is_change, uint64_t unlock_time) {}
|
||||
virtual void on_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, const std::string& asset_type, const cryptonote::subaddress_index& subaddr_index, bool is_change, uint64_t unlock_time, const uint64_t& origin_td_idx) {}
|
||||
virtual void on_unconfirmed_money_received(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx, uint64_t amount, const cryptonote::subaddress_index& subaddr_index) {}
|
||||
virtual void on_money_spent(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& in_tx, uint64_t amount, const std::string& asset_type, const cryptonote::transaction& spend_tx, const cryptonote::subaddress_index& subaddr_index) {}
|
||||
virtual void on_skip_transaction(uint64_t height, const crypto::hash &txid, const cryptonote::transaction& tx) {}
|
||||
@@ -346,6 +346,7 @@ private:
|
||||
std::vector<multisig_info> m_multisig_info; // one per other participant
|
||||
std::vector<std::pair<uint64_t, crypto::hash>> m_uses;
|
||||
std::string asset_type;
|
||||
uint64_t m_origin_td_idx;
|
||||
|
||||
bool is_rct() const { return m_rct; }
|
||||
uint64_t amount() const { return m_amount; }
|
||||
@@ -381,6 +382,7 @@ private:
|
||||
FIELD(m_multisig_info)
|
||||
FIELD(m_uses)
|
||||
FIELD(asset_type)
|
||||
FIELD(m_origin_td_idx)
|
||||
END_SERIALIZE()
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user