From f84a3239504603cbecba8e99b95fcec987a3acb6 Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Mon, 28 May 2018 20:48:56 -0300 Subject: [PATCH] log notarisation parse errors to file --- src/notarisationdb.cpp | 2 +- src/test-komodo/test_parse_notarisation.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/notarisationdb.cpp b/src/notarisationdb.cpp index 7ef5a0cf8..42a3ae41f 100644 --- a/src/notarisationdb.cpp +++ b/src/notarisationdb.cpp @@ -24,7 +24,7 @@ NotarisationsInBlock GetNotarisationsInBlock(const CBlock &block, int nHeight) if (ParseNotarisationOpReturn(tx, data)) vNotarisations.push_back(std::make_pair(tx.GetHash(), data)); else - fprintf(stderr, "Warning: Couldn't parse notarisation for tx: %s at height %i\n", + LogPrintf("WARNING: Couldn't parse notarisation for tx: %s at height %i\n", tx.GetHash().GetHex().data(), nHeight); } } diff --git a/src/test-komodo/test_parse_notarisation.cpp b/src/test-komodo/test_parse_notarisation.cpp index 285f98813..a61ca2aa3 100644 --- a/src/test-komodo/test_parse_notarisation.cpp +++ b/src/test-komodo/test_parse_notarisation.cpp @@ -20,4 +20,15 @@ TEST(TestParseNotarisation, test_ee2fa) ASSERT_TRUE(E_UNMARSHAL(opret, ss >> nd)); } +TEST(TestParseNotarisation, test__) +{ + // 576e910a1f704207bcbcf724124ff9adc5237f45cb6919589cd0aa152caec424 + std::vector opret = ParseHex("b3ed7fbbfbc027caeeeec81e65489ec5d9cd47cda675a5cbb75b4a845e67cf0ef6330300b5a6bd8385feb833f3be961c9d8a46fcecd36dcdfa42ad81a20a892433722f0b4b4d44004125a06024eae24c11f36ea110acd707b041d5355b6e1b42de5e2614357999c6aa02000d26ad0300000000404b4c000000000005130300500d000061f22ba7d19fe29ac3baebd839af8b7127d1f90755534400"); + NotarisationData nd; + // We can't parse this one + ASSERT_FALSE(E_UNMARSHAL(opret, ss >> nd)); +} + +// for l in `g 'parse notarisation' ~/.komodo/debug.log | pyline 'l.split()[8]'`; do hoek decodeTx '{"hex":"'`src/komodo-cli getrawtransaction "$l"`'"}' | jq '.outputs[1].script.op_return' | pyline 'import base64; print base64.b64decode(l).encode("hex")'; done + }