From ebbec75e6bc9e51a973d13ad78f277f7be2c2865 Mon Sep 17 00:00:00 2001 From: Djuri Baars Date: Mon, 6 Jan 2025 00:01:34 +0100 Subject: [PATCH] Fix V2 message parsing --- src/lib/v2_notify.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/lib/v2_notify.cpp b/src/lib/v2_notify.cpp index 560b39d..6d9fc61 100644 --- a/src/lib/v2_notify.cpp +++ b/src/lib/v2_notify.cpp @@ -127,7 +127,7 @@ namespace V2Notify void handleV2Message(JsonDocument doc) { - if (doc["blockheight"].is()) + if (doc["blockheight"].is()) { uint newBlockHeight = doc["blockheight"].as(); @@ -136,16 +136,29 @@ namespace V2Notify return; } + if (debugLogEnabled()) { + Serial.print(F("processNewBlock ")); + Serial.println(newBlockHeight); + } processNewBlock(newBlockHeight); } - else if (doc["blockfee"].is()) + else if (doc["blockfee"].is()) { uint medianFee = doc["blockfee"].as(); + if (debugLogEnabled()) { + Serial.print(F("processNewBlockFee ")); + Serial.println(medianFee); + } + processNewBlockFee(medianFee); } else if (doc["price"].is()) { + if (debugLogEnabled()) { + Serial.print(F("processNewPrice ")); + Serial.println(doc["price"].as().size()); + } // Iterate through the key-value pairs of the "price" object for (JsonPair kv : doc["price"].as())