From 97e721f5f506f4bd14633c267055e9079eb1305a Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Sat, 29 Jun 2019 00:39:34 +0300 Subject: [PATCH] fixed bug with payment id visualisation --- .../include/serialization/keyvalue_helpers.h | 17 +++++++++++++++++ .../serialization/keyvalue_serialization.h | 5 ++++- src/wallet/wallet_rpc_server_commans_defs.h | 2 +- utils/update_alert.json | 4 ++-- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/contrib/epee/include/serialization/keyvalue_helpers.h b/contrib/epee/include/serialization/keyvalue_helpers.h index 924ab892..9d0f1d74 100644 --- a/contrib/epee/include/serialization/keyvalue_helpers.h +++ b/contrib/epee/include/serialization/keyvalue_helpers.h @@ -64,6 +64,23 @@ namespace epee epee::string_tools::hex_to_pod(a, res); return res; } + + //basic helpers for blob-to-hex serialization + + inline std::string transform_binbuf_to_hexstr(const std::string& a) + { + return epee::string_tools::buff_to_hex_nodelimer(a); + } + + inline std::string transform_hexstr_to_binbuff(const std::string& a) + { + std::string res; + if (!epee::string_tools::parse_hexstr_to_binbuff(a, res)) + { + CHECK_AND_ASSERT_THROW_MES(false, "Failed to parse hex string:" << a); + } + return res; + } //------------------------------------------------------------------------------------------------------------------- diff --git a/contrib/epee/include/serialization/keyvalue_serialization.h b/contrib/epee/include/serialization/keyvalue_serialization.h index a73c6b87..88605b78 100644 --- a/contrib/epee/include/serialization/keyvalue_serialization.h +++ b/contrib/epee/include/serialization/keyvalue_serialization.h @@ -78,7 +78,8 @@ public: \ #define KV_SERIALIZE_POD_AS_HEX_STRING_N(varialble, val_name) \ KV_SERIALIZE_CUSTOM_N(varialble, std::string, epee::transform_t_pod_to_str, epee::transform_str_to_t_pod, val_name) - +#define KV_SERIALIZE_BLOB_AS_HEX_STRING_N(varialble, val_name) \ + KV_SERIALIZE_CUSTOM_N(varialble, std::string, epee::transform_binbuf_to_hexstr, epee::transform_hexstr_to_binbuff, val_name) #define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, val_name) \ @@ -99,6 +100,8 @@ public: \ #define KV_SERIALIZE_CONTAINER_POD_AS_BLOB(varialble) KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, #varialble) #define KV_SERIALIZE_CUSTOM(varialble, stored_type, from_v_to_stored, from_stored_to_v) KV_SERIALIZE_CUSTOM_N(varialble, stored_type, from_v_to_stored, from_stored_to_v, #varialble) #define KV_SERIALIZE_POD_AS_HEX_STRING(varialble) KV_SERIALIZE_POD_AS_HEX_STRING_N(varialble, #varialble) +#define KV_SERIALIZE_BLOB_AS_HEX_STRING(varialble) KV_SERIALIZE_BLOB_AS_HEX_STRING_N(varialble, #varialble) + #define KV_CHAIN_MAP(variable_obj) epee::namespace_accessor::template serialize_map(this_ref.variable_obj, stg, hparent_section); diff --git a/src/wallet/wallet_rpc_server_commans_defs.h b/src/wallet/wallet_rpc_server_commans_defs.h index eac1606c..370b0e04 100644 --- a/src/wallet/wallet_rpc_server_commans_defs.h +++ b/src/wallet/wallet_rpc_server_commans_defs.h @@ -115,7 +115,7 @@ namespace wallet_rpc KV_SERIALIZE(height) KV_SERIALIZE(unlock_time) KV_SERIALIZE(tx_blob_size) - KV_SERIALIZE(payment_id) + KV_SERIALIZE_BLOB_AS_HEX_STRING(payment_id) KV_SERIALIZE(remote_addresses) KV_SERIALIZE(recipients_aliases) KV_SERIALIZE(comment) diff --git a/utils/update_alert.json b/utils/update_alert.json index d2edba1a..90926d50 100644 --- a/utils/update_alert.json +++ b/utils/update_alert.json @@ -2,10 +2,10 @@ "maj":1, "min":0, "rev":0, - "build":37, + "build":40, "cs":[ { - "build":37, + "build":40, "mode":3 } ]