test
This commit is contained in:
41
src/komodo.h
41
src/komodo.h
@@ -21,6 +21,9 @@
|
||||
#include <pthread.h>
|
||||
#include "uthash.h"
|
||||
|
||||
#define KOMODO_INTEREST ((uint64_t)0.05 * COIN)
|
||||
#include "komodo_interest.h"
|
||||
|
||||
#define KOMODO_TESTNET_EXPIRATION 60000
|
||||
#define KOMODO_ELECTION_GAP 1000
|
||||
#define KOMODO_PUBKEYS_HEIGHT(height) ((int32_t)(((((height)+KOMODO_ELECTION_GAP*.5)/KOMODO_ELECTION_GAP) + 1) * KOMODO_ELECTION_GAP))
|
||||
@@ -246,44 +249,6 @@ int32_t komodo_threshold(int32_t height,uint64_t signedmask)
|
||||
else return(0);
|
||||
}
|
||||
|
||||
uint32_t komodo_txtime(uint256 hash)
|
||||
{
|
||||
CTransaction tx;
|
||||
uint256 hashBlock;
|
||||
if (!GetTransaction(hash, tx, hashBlock, true))
|
||||
{
|
||||
//printf("null GetTransaction\n");
|
||||
return(tx.nLockTime);
|
||||
}
|
||||
/*if (!hashBlock.IsNull()) {
|
||||
BlockMap::iterator mi = mapBlockIndex.find(hashBlock);
|
||||
if (mi != mapBlockIndex.end() && (*mi).second)
|
||||
{
|
||||
CBlockIndex* pindex = (*mi).second;
|
||||
if (chainActive.Contains(pindex))
|
||||
return(pindex->GetBlockTime());
|
||||
}
|
||||
//printf("cant find in iterator\n");
|
||||
}*/
|
||||
//printf("null hashBlock\n");
|
||||
return(0);
|
||||
}
|
||||
|
||||
uint64_t komodo_interest(uint64_t nValue,uint32_t nLockTime,uint32_t tiptime)
|
||||
{
|
||||
int32_t minutes,days; uint64_t interest = 0;
|
||||
if ( tiptime == 0 )
|
||||
tiptime = chainActive.Tip()->nTime;
|
||||
if ( nLockTime >= LOCKTIME_THRESHOLD && tiptime != 0 && nLockTime < tiptime && nValue >= COIN )
|
||||
{
|
||||
minutes = (tiptime - nLockTime) / 60;
|
||||
days = minutes / (24 * 60);
|
||||
interest = (nValue * 5000000) / (((uint64_t)365 * 100000000 * 24 * 60) / minutes);
|
||||
fprintf(stderr,"komodo_interest %lld %.8f nLockTime.%u tiptime.%u minutes.%d days.%d interest %lld %.8f\n",(long long)nValue,(double)nValue/100000000.,nLockTime,tiptime,minutes,days,(long long)interest,(double)interest/100000000);
|
||||
}
|
||||
return(interest * 0);
|
||||
}
|
||||
|
||||
void komodo_nutxoadd(int32_t addflag,int32_t height,int32_t notaryid,uint256 txhash,uint64_t voutmask,int32_t numvouts)
|
||||
{
|
||||
struct nutxo_entry *np;
|
||||
|
||||
Reference in New Issue
Block a user