From ddc1e188d74f1b97fba0b68bee191a0a651f5a94 Mon Sep 17 00:00:00 2001 From: miketout Date: Thu, 11 Apr 2024 10:56:23 -0700 Subject: [PATCH] Invalid memo exception fix --- src/key_io.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/key_io.cpp b/src/key_io.cpp index 9eae9a7b2af..29b85cf1559 100644 --- a/src/key_io.cpp +++ b/src/key_io.cpp @@ -987,6 +987,16 @@ std::vector VectorEncodeVDXFUni(const UniValue &_obj) UniValue obj = _obj; + if (!obj.isObject()) + { + std::string objStr = uni_get_str(obj); + if (IsHex(objStr)) + { + return ParseHex(objStr); + } + return std::vector(objStr.begin(), objStr.end()); + } + std::string serializedHex = uni_get_str(find_value(obj, "serializedhex")); if (!serializedHex.empty()) { @@ -1010,16 +1020,6 @@ std::vector VectorEncodeVDXFUni(const UniValue &_obj) return std::vector(serializedMessage.begin(), serializedMessage.end()); } - if (obj.isStr()) - { - std::string objStr = uni_get_str(obj); - if (IsHex(objStr)) - { - return ParseHex(objStr); - } - return std::vector(objStr.begin(), objStr.end()); - } - // this should be an object with "vdxfkey" as the key and {object} as the json object to serialize auto oneValKeys = obj.getKeys(); auto oneValValues = obj.getValues();