mirror of
https://github.com/monero-project/monero.git
synced 2024-12-25 04:59:43 +00:00
wallet: fix payment ID decryption for construction data
This commit is contained in:
parent
31bdf7bd11
commit
8630a028f2
1 changed files with 6 additions and 7 deletions
|
@ -763,9 +763,8 @@ uint64_t calculate_fee(bool use_per_byte_fee, const cryptonote::transaction &tx,
|
||||||
return calculate_fee(base_fee, blob_size, fee_multiplier);
|
return calculate_fee(base_fee, blob_size, fee_multiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
crypto::hash8 get_short_payment_id(const tools::wallet2::pending_tx &ptx, hw::device &hwdev)
|
bool get_short_payment_id(crypto::hash8 &payment_id8, const tools::wallet2::pending_tx &ptx, hw::device &hwdev)
|
||||||
{
|
{
|
||||||
crypto::hash8 payment_id8 = null_hash8;
|
|
||||||
std::vector<tx_extra_field> tx_extra_fields;
|
std::vector<tx_extra_field> tx_extra_fields;
|
||||||
parse_tx_extra(ptx.tx.extra, tx_extra_fields); // ok if partially parsed
|
parse_tx_extra(ptx.tx.extra, tx_extra_fields); // ok if partially parsed
|
||||||
cryptonote::tx_extra_nonce extra_nonce;
|
cryptonote::tx_extra_nonce extra_nonce;
|
||||||
|
@ -776,19 +775,19 @@ crypto::hash8 get_short_payment_id(const tools::wallet2::pending_tx &ptx, hw::de
|
||||||
if (ptx.dests.empty())
|
if (ptx.dests.empty())
|
||||||
{
|
{
|
||||||
MWARNING("Encrypted payment id found, but no destinations public key, cannot decrypt");
|
MWARNING("Encrypted payment id found, but no destinations public key, cannot decrypt");
|
||||||
return crypto::null_hash8;
|
return false;
|
||||||
}
|
}
|
||||||
hwdev.decrypt_payment_id(payment_id8, ptx.dests[0].addr.m_view_public_key, ptx.tx_key);
|
return hwdev.decrypt_payment_id(payment_id8, ptx.dests[0].addr.m_view_public_key, ptx.tx_key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return payment_id8;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
tools::wallet2::tx_construction_data get_construction_data_with_decrypted_short_payment_id(const tools::wallet2::pending_tx &ptx, hw::device &hwdev)
|
tools::wallet2::tx_construction_data get_construction_data_with_decrypted_short_payment_id(const tools::wallet2::pending_tx &ptx, hw::device &hwdev)
|
||||||
{
|
{
|
||||||
tools::wallet2::tx_construction_data construction_data = ptx.construction_data;
|
tools::wallet2::tx_construction_data construction_data = ptx.construction_data;
|
||||||
crypto::hash8 payment_id = get_short_payment_id(ptx,hwdev);
|
crypto::hash8 payment_id = null_hash8;
|
||||||
if (payment_id != null_hash8)
|
if (get_short_payment_id(payment_id, ptx, hwdev))
|
||||||
{
|
{
|
||||||
// Remove encrypted
|
// Remove encrypted
|
||||||
remove_field_from_tx_extra(construction_data.extra, typeid(cryptonote::tx_extra_nonce));
|
remove_field_from_tx_extra(construction_data.extra, typeid(cryptonote::tx_extra_nonce));
|
||||||
|
|
Loading…
Reference in a new issue