From ffda33998fc1123c53f6bb523284af110bf35409 Mon Sep 17 00:00:00 2001 From: miketout Date: Thu, 30 Aug 2018 19:40:07 -0700 Subject: [PATCH] Add fix to remove KMD coinbase check with pool fee workaround at block 227520 (~Oct 28th) --- src/crypto/verus_hash.cpp | 12 +++++++----- src/komodo_defs.h | 2 ++ src/komodo_gateway.h | 10 ++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/crypto/verus_hash.cpp b/src/crypto/verus_hash.cpp index aeae9712b..f5cb1c9f3 100644 --- a/src/crypto/verus_hash.cpp +++ b/src/crypto/verus_hash.cpp @@ -14,11 +14,12 @@ bit output. void (*CVerusHash::haraka512Function)(unsigned char *out, const unsigned char *in); -void CVerusHash::Hash(void *result, const void *data, size_t len) +void CVerusHash::Hash(void *result, const void *data, size_t _len) { unsigned char buf[128]; unsigned char *bufPtr = buf; - int pos = 0, nextOffset = 64; + int nextOffset = 64; + uint32_t pos = 0, len = _len; unsigned char *bufPtr2 = bufPtr + nextOffset; unsigned char *ptr = (unsigned char *)data; @@ -58,14 +59,15 @@ void CVerusHash::init() } } -CVerusHash &CVerusHash::Write(const unsigned char *data, size_t len) +CVerusHash &CVerusHash::Write(const unsigned char *data, size_t _len) { unsigned char *tmp; + uint32_t pos, len = _len; // digest up to 32 bytes at a time - for ( int pos = 0; pos < len; ) + for ( pos = 0; pos < len; ) { - int room = 32 - curPos; + uint32_t room = 32 - curPos; if (len - pos >= room) { diff --git a/src/komodo_defs.h b/src/komodo_defs.h index 22aded23a..3b9f85a0a 100644 --- a/src/komodo_defs.h +++ b/src/komodo_defs.h @@ -9,5 +9,7 @@ #define KOMODO_LIMITED_NETWORKSIZE 4 #define KOMODO_MAXMEMPOOLTIME 3600 // affects consensus #define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9" +#define VRSC_KMD_MERGE_FIX 227520 // height that the inadvertent KMD merge/coinbase output changes to VRSC are removed + // approximately October 28th #endif diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 183b6bb54..ce8aebd24 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -687,10 +687,12 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim } } } - n = block.vtx[0].vout.size(); - //script = (uint8_t *)block.vtx[0].vout[n-1].scriptPubKey.data(); - //if ( n <= 2 || script[0] != 0x6a ) + // we don't want any of these checks in VRSC, leave it for other chains until/unless KMD removes + if ( ASSETCHAINS_SYMBOL[0] == 0 || + (ASSETCHAINS_COMMISSION != 0 && height > 1) || + (strcmp(ASSETCHAINS_SYMBOL,"VRSC") == 0 && height < VRSC_KMD_MERGE_FIX) ) { + n = block.vtx[0].vout.size(); int64_t val,prevtotal = 0; int32_t strangeout=0,overflow = 0; total = 0; for (i=1; i