mirror of
https://github.com/wownero/wownero.git
synced 2026-10-22 01:48:34 +02:00
wallet_rpc_server: preserve payment ID when editing address book
This commit is contained in:
@@ -3347,14 +3347,14 @@ namespace tools
|
|||||||
}
|
}
|
||||||
entry.m_address = info.address;
|
entry.m_address = info.address;
|
||||||
entry.m_is_subaddress = info.is_subaddress;
|
entry.m_is_subaddress = info.is_subaddress;
|
||||||
if (info.has_payment_id)
|
entry.m_has_payment_id = info.has_payment_id;
|
||||||
entry.m_payment_id = info.payment_id;
|
entry.m_payment_id = info.has_payment_id ? info.payment_id : crypto::null_hash8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.set_description)
|
if (req.set_description)
|
||||||
entry.m_description = req.description;
|
entry.m_description = req.description;
|
||||||
|
|
||||||
if (!m_wallet->set_address_book_row(req.index, entry.m_address, req.set_address && entry.m_has_payment_id ? &entry.m_payment_id : NULL, entry.m_description, entry.m_is_subaddress))
|
if (!m_wallet->set_address_book_row(req.index, entry.m_address, entry.m_has_payment_id ? &entry.m_payment_id : NULL, entry.m_description, entry.m_is_subaddress))
|
||||||
{
|
{
|
||||||
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
er.code = WALLET_RPC_ERROR_CODE_UNKNOWN_ERROR;
|
||||||
er.message = "Failed to edit address book entry";
|
er.message = "Failed to edit address book entry";
|
||||||
|
|||||||
@@ -231,6 +231,18 @@ class AddressBookTest():
|
|||||||
res = wallet.get_address_book([1])
|
res = wallet.get_address_book([1])
|
||||||
assert len(res.entries) == 1
|
assert len(res.entries) == 1
|
||||||
assert e == res.entries[0]
|
assert e == res.entries[0]
|
||||||
|
# change integrated address to standard address
|
||||||
|
res = wallet.edit_address_book(2, address = '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm')
|
||||||
|
res = wallet.get_address_book([2])
|
||||||
|
e = res.entries[0]
|
||||||
|
assert e.address == '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm'
|
||||||
|
# change integrated address to another integrated address
|
||||||
|
res = wallet.make_integrated_address()
|
||||||
|
integrated_address_2 = res.integrated_address
|
||||||
|
res = wallet.edit_address_book(2, address = integrated_address_2)
|
||||||
|
res = wallet.get_address_book([2])
|
||||||
|
e = res.entries[0]
|
||||||
|
assert e.address == integrated_address_2
|
||||||
|
|
||||||
# empty
|
# empty
|
||||||
wallet.delete_address_book(0)
|
wallet.delete_address_book(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user