Updating branch (#108)
* Fix * -print * Filter null outputs * Rewards cc * Fix * Linker * Fix * Fix * KOMODO_LONGESTCHAIN * Mining_height * Fix dropped assetoshis * Error null CCvin * Test * Test * Test * Fix sell * Fix order book prints * ) * Test * Test * Fix order display * Fix oops * Fix duplicate vin * Remove dust check * Fix silly bug * Test * Test * Fix * Test * Test * Test * Test * Test * Test * Test * Fix compiler error: call of overloaded 'Pair(const char [9], time_t)' is ambiguous * Fix compiler error: call of overloaded 'Pair(const char [9], time_t)' is ambiguous * Correctly parse optional top parameter to getsnapshot * Fix token orders crash * Add SEC to assetchains.json * Split amounts/validation: bid, ask, swap * Fixes * Test * Test * Test * Test * +print * Test * Test * Test * Test * Test * Test * SMALLVAL * Test * Test * Test * Test * Test * Test * Test * Properly handle multiple vins funding fills * Test * Test * Test * Test * Fix ask fill dest * Test * Rewards functions * Fix * Test * Params to rewardscalc * Create funding, addfunding, lock * Test * +print * tokenswapask * Test * Test * Swap functions * ac_cc under 1000 is not fungible * Allow to cancel invalid orders * Prevent negative numbers in assets tx * Uint64 -> int64 * Fix oops * Prevent bid for nonexistent assetid * Error check bidding for assetid that is txid but not asset creation * Fix * Fix * Add pause if scriptcheckqueue isn't idle * Fix * -> -> . * Fix * Test * VOBJ * Tokeninfo rpc * Asset list * Test * strcpy(cp->normaladdr,AssetsNormaladdr); * Fix * Rewardslist rewardsinfo * Fix * Fix * Fix * Vent * fix * Int64 * Int64 * Fix createfunding * Fix false positive error * sbits = stringbits(planstr); * Fix maxmoney * Fix funding name * Test * Print * CCutoxvalue * Fix rewardslock utxo selection * New PoW diff calc * tst * Test * Oldflag for PoW calc * Test * Test * tst * Test * Test * Filter locked utxo * Test * Fix PoW recalc * Test min seconds * int64_t CCduration(uint256 txid) * Test * Test * Test one day * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Prevent inputs of CC inputs * Test * tst * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * Test * New rewards address * Fix mask * Test * Test * Test * Test * Test * Test * Teest * Stricter vin/vout checks for assets * Token swap ready for testing * Fix rewards unlock * Fix * Test * Validate rewards * Test * Trim funding input * Test * Test * Test * Test * Test * Test * Test * Test * Test * Activate CCduration constraint * Parameterize KOMODO_FIRSTFUNGIBLEID to 100 * +print * Test * Test * Test * Test * Fix c script * Test * Initial dice morph from rewards.cpp * Fix * Test * Fix * Test * Diceaddfunds * Fix * Dice list and dice info * dicefund * Dice bet * Test * Test * Put process block's check block call inside lock, revert mining testblockvalidity outside lock * Don't exit fiat-cli on error * Docs for coinsupply RPC and improved error-checking on block height * Version to 0.3.12-beta. * Change version to 0.3.12 for gilab CI. * Put undefines for _cpuid back. * Network decentralizatoin and bug fixes * Remove unnecessary staking delay * Staking and mining timeing improvements * Put staking readout once per staking loop so people know it's staking * Fail on get_chainactive before lock if checks fail * Fix check for stake transaction after Komodo merge * Portable dev (#105) * Force portable code * Switch to old MMX instructions, avoiding SSE & SSE2 instructions. * Less agressive, leave verus code (which checks for it) using advanced instructions. * Compiling only for windows * Update .gitlab-ci.yml * Try -march=native for C++ code generation. * Tweaking machine architecture settings. * Try native alone. * Also get LIBCRYPTOCONDITIONS to -march=native * Switch other lib to native as well. * Try switching back further for CPU architecture. * Even lower end settings. * Turn on symbols. * Use sse2,3 and 4 capable x64. * Once again let verus lib use advances instructioins since it checjs via CPUID at run time. * Modify a few more makefile entries. * Switch to AMD model similar to our test system. * Get snark makefile to k8 too. * Yet another -march to modify to k8, or two of them. * Brute force k8 settings, comment non-portable code out. * Put the condition on cpuid back. * Put non-portable advenced instruction code back * Enable instructions. * Add lib for separate settings. * Update .gitlab-ci.yml * Update .gitlab-ci.yml * Update .gitlab-ci.yml * Update .gitlab-ci.yml * replacing k8-sse3 specific flags to x86-84 * updating versions * updating versions * Get verus-cli verusd updated (#106) * Force portable code * Switch to old MMX instructions, avoiding SSE & SSE2 instructions. * Less agressive, leave verus code (which checks for it) using advanced instructions. * Compiling only for windows * Update .gitlab-ci.yml * Try -march=native for C++ code generation. * Tweaking machine architecture settings. * Try native alone. * Also get LIBCRYPTOCONDITIONS to -march=native * Switch other lib to native as well. * Try switching back further for CPU architecture. * Even lower end settings. * Turn on symbols. * Use sse2,3 and 4 capable x64. * Once again let verus lib use advances instructioins since it checjs via CPUID at run time. * Modify a few more makefile entries. * Switch to AMD model similar to our test system. * Get snark makefile to k8 too. * Yet another -march to modify to k8, or two of them. * Brute force k8 settings, comment non-portable code out. * Put the condition on cpuid back. * Put non-portable advenced instruction code back * Enable instructions. * Add lib for separate settings. * Update .gitlab-ci.yml * Update .gitlab-ci.yml * Update .gitlab-ci.yml * Update .gitlab-ci.yml * replacing k8-sse3 specific flags to x86-84 * updating versions * Propagate verusd changes.
This commit is contained in:
@@ -19,53 +19,29 @@
|
||||
struct komodo_ccdata *CC_data;
|
||||
int32_t CC_firstheight;
|
||||
|
||||
bits256 iguana_merkle(bits256 *tree,int32_t txn_count)
|
||||
{
|
||||
int32_t i,n=0,prev; uint8_t serialized[sizeof(bits256) * 2];
|
||||
if ( txn_count == 1 )
|
||||
return(tree[0]);
|
||||
prev = 0;
|
||||
while ( txn_count > 1 )
|
||||
{
|
||||
if ( (txn_count & 1) != 0 )
|
||||
tree[prev + txn_count] = tree[prev + txn_count-1], txn_count++;
|
||||
n += txn_count;
|
||||
for (i=0; i<txn_count; i+=2)
|
||||
{
|
||||
iguana_rwbignum(1,serialized,sizeof(*tree),tree[prev + i].bytes);
|
||||
iguana_rwbignum(1,&serialized[sizeof(*tree)],sizeof(*tree),tree[prev + i + 1].bytes);
|
||||
tree[n + (i >> 1)] = bits256_doublesha256(0,serialized,sizeof(serialized));
|
||||
}
|
||||
prev = n;
|
||||
txn_count >>= 1;
|
||||
}
|
||||
return(tree[n]);
|
||||
}
|
||||
uint256 BuildMerkleTree(bool* fMutated, const std::vector<uint256> leaves, std::vector<uint256> &vMerkleTree);
|
||||
|
||||
uint256 komodo_calcMoM(int32_t height,int32_t MoMdepth)
|
||||
{
|
||||
static uint256 zero; bits256 MoM,*tree; CBlockIndex *pindex; int32_t i;
|
||||
static uint256 zero; CBlockIndex *pindex; int32_t i; std::vector<uint256> tree, leaves;
|
||||
bool fMutated;
|
||||
MoMdepth &= 0xffff; // In case it includes the ccid
|
||||
if ( MoMdepth >= height )
|
||||
return(zero);
|
||||
tree = (bits256 *)calloc(MoMdepth * 3,sizeof(*tree));
|
||||
for (i=0; i<MoMdepth; i++)
|
||||
{
|
||||
if ( (pindex= komodo_chainactive(height - i)) != 0 )
|
||||
memcpy(&tree[i],&pindex->hashMerkleRoot,sizeof(bits256));
|
||||
leaves.push_back(pindex->hashMerkleRoot);
|
||||
else
|
||||
{
|
||||
free(tree);
|
||||
return(zero);
|
||||
}
|
||||
}
|
||||
MoM = iguana_merkle(tree,MoMdepth);
|
||||
free(tree);
|
||||
return(*(uint256 *)&MoM);
|
||||
return BuildMerkleTree(&fMutated, leaves, tree);
|
||||
}
|
||||
|
||||
struct komodo_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t kmdstarti,int32_t kmdendi)
|
||||
{
|
||||
struct komodo_ccdata_entry *allMoMs=0; bits256 *tree,tmp; struct komodo_ccdata *ccdata,*tmpptr; int32_t i,num,max;
|
||||
struct komodo_ccdata_entry *allMoMs=0; struct komodo_ccdata *ccdata,*tmpptr; int32_t i,num,max;
|
||||
bool fMutated; std::vector<uint256> tree, leaves;
|
||||
num = max = 0;
|
||||
portable_mutex_lock(&KOMODO_CC_mutex);
|
||||
DL_FOREACH_SAFE(CC_data,ccdata,tmpptr)
|
||||
@@ -90,11 +66,9 @@ struct komodo_ccdata_entry *komodo_allMoMs(int32_t *nump,uint256 *MoMoMp,int32_t
|
||||
portable_mutex_unlock(&KOMODO_CC_mutex);
|
||||
if ( (*nump= num) > 0 )
|
||||
{
|
||||
tree = (bits256 *)calloc(sizeof(bits256),num*3);
|
||||
for (i=0; i<num; i++)
|
||||
memcpy(&tree[i],&allMoMs[i].MoM,sizeof(tree[i]));
|
||||
tmp = iguana_merkle(tree,num);
|
||||
memcpy(MoMoMp,&tmp,sizeof(*MoMoMp));
|
||||
leaves.push_back(allMoMs[i].MoM);
|
||||
*MoMoMp = BuildMerkleTree(&fMutated, leaves, tree);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user