post launch release readiness
This commit is contained in:
@@ -92,7 +92,7 @@ public:
|
|||||||
{
|
{
|
||||||
strNetworkID = "main";
|
strNetworkID = "main";
|
||||||
strCurrencyUnits = "KMD";
|
strCurrencyUnits = "KMD";
|
||||||
consensus.fCoinbaseMustBeProtected = true; // this is only enforced after block 12800 on Verus
|
consensus.fCoinbaseMustBeProtected = false; // true this is only true wuth Verus and enforced after block 12800
|
||||||
consensus.nSubsidySlowStartInterval = 20000;
|
consensus.nSubsidySlowStartInterval = 20000;
|
||||||
consensus.nSubsidyHalvingInterval = 840000;
|
consensus.nSubsidyHalvingInterval = 840000;
|
||||||
consensus.nMajorityEnforceBlockUpgrade = 750;
|
consensus.nMajorityEnforceBlockUpgrade = 750;
|
||||||
@@ -232,6 +232,12 @@ void *chainparams_commandline(void *ptr)
|
|||||||
mainParams.pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff;
|
mainParams.pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff;
|
||||||
fprintf(stderr,">>>>>>>>>> %s: p2p.%u rpc.%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY);
|
fprintf(stderr,">>>>>>>>>> %s: p2p.%u rpc.%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY);
|
||||||
|
|
||||||
|
// only require coinbase protection on Verus from the Komodo family of coins
|
||||||
|
if (strcmp(ASSETCHAINS_SYMBOL,"VRSC") == 0)
|
||||||
|
{
|
||||||
|
mainParams.consensus.fCoinbaseMustBeProtected = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH)
|
if (ASSETCHAINS_ALGO != ASSETCHAINS_EQUIHASH)
|
||||||
{
|
{
|
||||||
// this is only good for 60 second blocks with an averaging window of 45. for other parameters, use:
|
// this is only good for 60 second blocks with an averaging window of 45. for other parameters, use:
|
||||||
|
|||||||
@@ -391,7 +391,11 @@ const CScript &CCoinsViewCache::GetSpendFor(const CCoins *coins, const CTxIn& in
|
|||||||
std::string hc = input.prevout.hash.ToString();
|
std::string hc = input.prevout.hash.ToString();
|
||||||
if (LaunchMap().lmap.count(hc))
|
if (LaunchMap().lmap.count(hc))
|
||||||
{
|
{
|
||||||
return LaunchMap().lmap[hc];
|
CTransactionExceptionData &txData = LaunchMap().lmap[hc];
|
||||||
|
if ((txData.voutMask & (((uint64_t)1) << (uint64_t)input.prevout.n)) != 0)
|
||||||
|
{
|
||||||
|
return txData.scriptPubKey;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return coins->vout[input.prevout.n].scriptPubKey;
|
return coins->vout[input.prevout.n].scriptPubKey;
|
||||||
|
|||||||
26
src/coins.h
26
src/coins.h
@@ -441,23 +441,31 @@ public:
|
|||||||
friend class CCoinsViewCache;
|
friend class CCoinsViewCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CTransactionExceptionData
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CScript scriptPubKey;
|
||||||
|
uint64_t voutMask;
|
||||||
|
CTransactionExceptionData() : scriptPubKey(), voutMask() {}
|
||||||
|
};
|
||||||
|
|
||||||
class CLaunchMap
|
class CLaunchMap
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::unordered_map<std::string, CScript> lmap;
|
std::unordered_map<std::string, CTransactionExceptionData> lmap;
|
||||||
CLaunchMap() : lmap()
|
CLaunchMap() : lmap()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < WHITELIST_COUNT; i++)
|
//printf("txid: %s -> addr: %s\n", whitelist_ids[i], whitelist_addrs[i]);
|
||||||
|
CBitcoinAddress bcaddr(whitelist_address);
|
||||||
|
CKeyID key;
|
||||||
|
if (bcaddr.GetKeyID_NoCheck(key))
|
||||||
{
|
{
|
||||||
printf("txid: %s -> addr: %s", whitelist_ids[i], whitelist_addrs[i]);
|
std::vector<unsigned char> address = std::vector<unsigned char>(key.begin(), key.end());
|
||||||
CBitcoinAddress address(whitelist_addrs[i]);
|
for (int i = 0; i < WHITELIST_COUNT; i++)
|
||||||
CKeyID key;
|
|
||||||
if (address.GetKeyID_NoCheck(key))
|
|
||||||
{
|
{
|
||||||
std::vector<unsigned char> adr = std::vector<unsigned char>(key.begin(), key.end());
|
|
||||||
std::string hash = uint256S(whitelist_ids[i]).ToString();
|
std::string hash = uint256S(whitelist_ids[i]).ToString();
|
||||||
lmap[hash] = CScript();
|
lmap[hash].scriptPubKey << OP_DUP << OP_HASH160 << address << OP_EQUALVERIFY << OP_CHECKSIG;
|
||||||
lmap[hash] << OP_DUP << OP_HASH160 << adr << OP_EQUALVERIFY << OP_CHECKSIG;
|
lmap[hash].voutMask = whitelist_masks[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,3 +73,8 @@ CVerusHash &CVerusHash::Write(const unsigned char *data, size_t len)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// to be declared and accessed from C
|
||||||
|
void verus_hash(void *result, const void *data, size_t len)
|
||||||
|
{
|
||||||
|
return CVerusHash::Hash(result, data, len);
|
||||||
|
}
|
||||||
|
|||||||
@@ -51,4 +51,6 @@ class CVerusHash
|
|||||||
size_t curPos = 0;
|
size_t curPos = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern void verus_hash(void *result, const void *data, size_t len);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
#define portable_mutex_lock pthread_mutex_lock
|
#define portable_mutex_lock pthread_mutex_lock
|
||||||
#define portable_mutex_unlock pthread_mutex_unlock
|
#define portable_mutex_unlock pthread_mutex_unlock
|
||||||
|
|
||||||
|
extern void verus_hash(void *result, const void *data, size_t len);
|
||||||
|
|
||||||
struct allocitem { uint32_t allocsize,type; };
|
struct allocitem { uint32_t allocsize,type; };
|
||||||
struct queueitem { struct queueitem *next,*prev; uint32_t allocsize,type; };
|
struct queueitem { struct queueitem *next,*prev; uint32_t allocsize,type; };
|
||||||
|
|
||||||
@@ -1022,23 +1024,45 @@ int32_t komodo_opreturnscript(uint8_t *script,uint8_t type,uint8_t *opret,int32_
|
|||||||
// from all other blocks. the sequence is extremely likely, but not guaranteed to be unique for each block chain
|
// from all other blocks. the sequence is extremely likely, but not guaranteed to be unique for each block chain
|
||||||
uint64_t komodo_block_prg(uint32_t nHeight)
|
uint64_t komodo_block_prg(uint32_t nHeight)
|
||||||
{
|
{
|
||||||
int i;
|
if (strcmp(ASSETCHAINS_SYMBOL, "VRSC") != 0 || nHeight >= 12800)
|
||||||
uint8_t hashSrc[8];
|
|
||||||
uint64_t result, hashSrc64 = (uint64_t)ASSETCHAINS_MAGIC << 32 + nHeight;
|
|
||||||
bits256 hashResult;
|
|
||||||
|
|
||||||
for ( i = 0; i < sizeof(hashSrc); i++ )
|
|
||||||
{
|
{
|
||||||
hashSrc[i] = hashSrc64 & 0xff;
|
uint64_t i, result = 0, hashSrc64 = ((uint64_t)ASSETCHAINS_MAGIC << 32) | (uint64_t)nHeight;
|
||||||
hashSrc64 >>= 8;
|
uint8_t hashSrc[8];
|
||||||
}
|
bits256 hashResult;
|
||||||
vcalc_sha256(0, hashResult.bytes, hashSrc, sizeof(hashSrc));
|
|
||||||
|
|
||||||
for ( i = 0; i < 8; i++ )
|
for ( i = 0; i < sizeof(hashSrc); i++ )
|
||||||
{
|
{
|
||||||
result = (result << 8) + hashResult.bytes[i];
|
uint64_t x = hashSrc64 >> (i * 8);
|
||||||
|
hashSrc[i] = (uint8_t)(x & 0xff);
|
||||||
|
}
|
||||||
|
verus_hash(hashResult.bytes, hashSrc, sizeof(hashSrc));
|
||||||
|
for ( i = 0; i < 8; i++ )
|
||||||
|
{
|
||||||
|
result = (result << 8) | hashResult.bytes[i];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
uint8_t hashSrc[8];
|
||||||
|
uint64_t result, hashSrc64 = (uint64_t)ASSETCHAINS_MAGIC << 32 + nHeight;
|
||||||
|
bits256 hashResult;
|
||||||
|
|
||||||
|
for ( i = 0; i < sizeof(hashSrc); i++ )
|
||||||
|
{
|
||||||
|
hashSrc[i] = hashSrc64 & 0xff;
|
||||||
|
hashSrc64 >>= 8;
|
||||||
|
int8_t b = hashSrc[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
vcalc_sha256(0, hashResult.bytes, hashSrc, sizeof(hashSrc));
|
||||||
|
for ( i = 0; i < 8; i++ )
|
||||||
|
{
|
||||||
|
result = (result << 8) + hashResult.bytes[i];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
return(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// given a block height, this returns the unlock time for that block height, derived from
|
// given a block height, this returns the unlock time for that block height, derived from
|
||||||
@@ -1055,8 +1079,7 @@ int64_t komodo_block_unlocktime(uint32_t nHeight)
|
|||||||
if (strcmp(ASSETCHAINS_SYMBOL, "VRSC") != 0 || nHeight >= 12800)
|
if (strcmp(ASSETCHAINS_SYMBOL, "VRSC") != 0 || nHeight >= 12800)
|
||||||
{
|
{
|
||||||
unlocktime = komodo_block_prg(nHeight) % (ASSETCHAINS_TIMEUNLOCKTO - ASSETCHAINS_TIMEUNLOCKFROM);
|
unlocktime = komodo_block_prg(nHeight) % (ASSETCHAINS_TIMEUNLOCKTO - ASSETCHAINS_TIMEUNLOCKFROM);
|
||||||
// boundary and power of 2 can make it exceed to time by 1
|
unlocktime += ASSETCHAINS_TIMEUNLOCKFROM;
|
||||||
unlocktime = unlocktime + ASSETCHAINS_TIMEUNLOCKFROM;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1041,7 +1041,7 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp)
|
|||||||
TxInErrorToJSON(txin, vErrors, "Input not found or already spent");
|
TxInErrorToJSON(txin, vErrors, "Input not found or already spent");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const CScript& prevPubKey = coins->vout[txin.prevout.n].scriptPubKey;
|
const CScript& prevPubKey = CCoinsViewCache::GetSpendFor(coins, txin);
|
||||||
const CAmount& amount = coins->vout[txin.prevout.n].nValue;
|
const CAmount& amount = coins->vout[txin.prevout.n].nValue;
|
||||||
|
|
||||||
SignatureData sigdata;
|
SignatureData sigdata;
|
||||||
|
|||||||
1416
src/veruslaunch.cpp
1416
src/veruslaunch.cpp
File diff suppressed because it is too large
Load Diff
@@ -8,9 +8,10 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#define WHITELIST_COUNT 0
|
#define WHITELIST_COUNT 704
|
||||||
|
|
||||||
extern const char *whitelist_ids[WHITELIST_COUNT];
|
extern const char *whitelist_ids[WHITELIST_COUNT];
|
||||||
extern const char *whitelist_addrs[WHITELIST_COUNT];
|
extern const char *whitelist_address;
|
||||||
|
extern uint64_t whitelist_masks[WHITELIST_COUNT];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user