mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-17 23:31:32 +02:00
wallet jni sets tx m_is_incoming, m_is_outgoing
This commit is contained in:
@@ -98,6 +98,7 @@ namespace monero {
|
||||
tx->m_block = block;
|
||||
block->m_txs.push_back(tx);
|
||||
tx->m_id = string_tools::pod_to_hex(pd.m_tx_hash);
|
||||
tx->m_is_incoming = true;
|
||||
tx->m_payment_id = string_tools::pod_to_hex(payment_id);
|
||||
if (tx->m_payment_id->substr(16).find_first_not_of('0') == std::string::npos) tx->m_payment_id = tx->m_payment_id->substr(0, 16); // TODO monero core: this should be part of core wallet
|
||||
if (tx->m_payment_id == monero_tx::DEFAULT_PAYMENT_ID) tx->m_payment_id = boost::none; // clear default payment id
|
||||
@@ -150,6 +151,7 @@ namespace monero {
|
||||
tx->m_block = block;
|
||||
block->m_txs.push_back(tx);
|
||||
tx->m_id = string_tools::pod_to_hex(txid);
|
||||
tx->m_is_outgoing = true;
|
||||
tx->m_payment_id = string_tools::pod_to_hex(pd.m_payment_id);
|
||||
if (tx->m_payment_id->substr(16).find_first_not_of('0') == std::string::npos) tx->m_payment_id = tx->m_payment_id->substr(0, 16); // TODO monero core: this should be part of core wallet
|
||||
if (tx->m_payment_id == monero_tx::DEFAULT_PAYMENT_ID) tx->m_payment_id = boost::none; // clear default payment id
|
||||
@@ -217,6 +219,7 @@ namespace monero {
|
||||
const tools::wallet2::payment_details &pd = ppd.m_pd;
|
||||
shared_ptr<monero_tx_wallet> tx = make_shared<monero_tx_wallet>();
|
||||
tx->m_id = string_tools::pod_to_hex(pd.m_tx_hash);
|
||||
tx->m_is_incoming = true;
|
||||
tx->m_payment_id = string_tools::pod_to_hex(payment_id);
|
||||
if (tx->m_payment_id->substr(16).find_first_not_of('0') == std::string::npos) tx->m_payment_id = tx->m_payment_id->substr(0, 16); // TODO monero core: this should be part of core wallet
|
||||
if (tx->m_payment_id == monero_tx::DEFAULT_PAYMENT_ID) tx->m_payment_id = boost::none; // clear default payment id
|
||||
@@ -258,6 +261,7 @@ namespace monero {
|
||||
shared_ptr<monero_tx_wallet> tx = make_shared<monero_tx_wallet>();
|
||||
tx->m_is_failed = pd.m_state == tools::wallet2::unconfirmed_transfer_details::failed;
|
||||
tx->m_id = string_tools::pod_to_hex(txid);
|
||||
tx->m_is_outgoing = true;
|
||||
tx->m_payment_id = string_tools::pod_to_hex(pd.m_payment_id);
|
||||
if (tx->m_payment_id->substr(16).find_first_not_of('0') == std::string::npos) tx->m_payment_id = tx->m_payment_id->substr(0, 16); // TODO monero core: this should be part of core wallet
|
||||
if (tx->m_payment_id == monero_tx::DEFAULT_PAYMENT_ID) tx->m_payment_id = boost::none; // clear default payment id
|
||||
@@ -1605,6 +1609,10 @@ namespace monero {
|
||||
vector<shared_ptr<monero_transfer>> transfers;
|
||||
for (const shared_ptr<monero_tx_wallet>& tx : txs) {
|
||||
|
||||
// tx is not incoming/outgoing unless already set
|
||||
if (tx->m_is_incoming == boost::none) tx->m_is_incoming = false;
|
||||
if (tx->m_is_outgoing == boost::none) tx->m_is_outgoing = false;
|
||||
|
||||
// sort transfers
|
||||
sort(tx->m_incoming_transfers.begin(), tx->m_incoming_transfers.end(), incoming_transfer_before);
|
||||
|
||||
|
||||
@@ -191,6 +191,8 @@ namespace monero {
|
||||
}
|
||||
|
||||
// merge simple extensions
|
||||
m_is_incoming = gen_utils::reconcile(m_is_incoming, other->m_is_incoming);
|
||||
m_is_outgoing = gen_utils::reconcile(m_is_outgoing, other->m_is_outgoing);
|
||||
m_note = gen_utils::reconcile(m_note, other->m_note);
|
||||
m_is_unlocked = gen_utils::reconcile(m_is_unlocked, other->m_is_unlocked);
|
||||
m_input_sum = gen_utils::reconcile(m_input_sum, other->m_input_sum);
|
||||
|
||||
Reference in New Issue
Block a user