LNS_OWNERS_TO_NAMES rpc fixes

- Add missing expiration_height serialization.
- Add "include_expired" field (to match LNS_NAMES_TO_OWNERS).
This commit is contained in:
Jason Rhinelander 2020-10-08 23:08:02 -03:00
parent 3715b60810
commit f76c75f28c
3 changed files with 6 additions and 1 deletions

View file

@ -3414,7 +3414,9 @@ namespace cryptonote { namespace rpc {
}
lns::name_system_db &db = m_core.get_blockchain_storage().name_system_db();
auto height = m_core.get_current_blockchain_height();
std::optional<uint64_t> height;
if (!req.include_expired) height = m_core.get_current_blockchain_height();
std::vector<lns::mapping_record> records = db.get_mappings_by_owners(owners, height);
for (auto &record : records)
{

View file

@ -1337,6 +1337,7 @@ KV_SERIALIZE_MAP_CODE_END()
KV_SERIALIZE_MAP_CODE_BEGIN(LNS_OWNERS_TO_NAMES::request)
KV_SERIALIZE(entries)
KV_SERIALIZE(include_expired)
KV_SERIALIZE_MAP_CODE_END()
@ -1348,6 +1349,7 @@ KV_SERIALIZE_MAP_CODE_BEGIN(LNS_OWNERS_TO_NAMES::response_entry)
KV_SERIALIZE(backup_owner)
KV_SERIALIZE(encrypted_value)
KV_SERIALIZE(update_height)
KV_SERIALIZE(expiration_height)
KV_SERIALIZE(txid)
KV_SERIALIZE_MAP_CODE_END()

View file

@ -2463,6 +2463,7 @@ namespace rpc {
struct request
{
std::vector<std::string> entries; // The owner's public key to find all Loki Name Service entries for.
bool include_expired; // Optional: if provided and true, include entries in the results even if they are expired
KV_MAP_SERIALIZABLE
};