From e69b5ed857b86a9cf3b026aa59e1eec453cae4d5 Mon Sep 17 00:00:00 2001 From: Sebastian Rusu Date: Tue, 7 Apr 2020 22:07:58 +0300 Subject: [PATCH] Added correct deserialization of amounts in contributions. --- src/script/script.h | 5 +++++ src/stake/staketx.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/script/script.h b/src/script/script.h index 67c37eae0..b11bb3484 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -320,6 +320,11 @@ class CScriptNum return m_value; } + int64_t getint64() const + { + return m_value; + } + std::vector getvch() const { return serialize(m_value); diff --git a/src/stake/staketx.cpp b/src/stake/staketx.cpp index f5eab90bc..66d2fb0ec 100644 --- a/src/stake/staketx.cpp +++ b/src/stake/staketx.cpp @@ -187,8 +187,8 @@ bool ParseTicketContrib(const CTransaction& tx, uint32_t txoutIndex, TicketContr data.rewardAddr = uint160(items[contribAddrIndex]); data.whichAddr = CScriptNum(items[contribAddrTypeIndex],false).getint(); - data.contributedAmount = CScriptNum(items[contribAmountIndex], false).getint(); // CScriptNum can handle 32-byte integers; is that enough? - //data.contributedAmount = base_blob<64>(items[contribAmountIndex]).GetUint64(0); // this parses uint64 but not int64 + + data.contributedAmount = CScriptNum(items[contribAmountIndex], false, 8).getint64(); int fees = CScriptNum(items[contribVoteFeesIndex], false).getint(); if (fees >= 0 && fees <= TicketContribData::MaxFees)