10
src/komodo.h
10
src/komodo.h
@@ -538,7 +538,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
|
|||||||
return(-1);
|
return(-1);
|
||||||
if ( scriptlen == 35 && scriptbuf[0] == 33 && scriptbuf[34] == 0xac )
|
if ( scriptlen == 35 && scriptbuf[0] == 33 && scriptbuf[34] == 0xac )
|
||||||
{
|
{
|
||||||
if ( i == 0 && j == 0 && memcmp(NOTARY_PUBKEY33,scriptbuf+1,33) == 0 && NOTARY_PUBKEY33[0] != 0 )
|
if ( i == 0 && j == 0 && memcmp(NOTARY_PUBKEY33,scriptbuf+1,33) == 0 && IS_KOMODO_NOTARY != 0 )
|
||||||
{
|
{
|
||||||
printf("%s KOMODO_LASTMINED.%d -> %d\n",ASSETCHAINS_SYMBOL,KOMODO_LASTMINED,height);
|
printf("%s KOMODO_LASTMINED.%d -> %d\n",ASSETCHAINS_SYMBOL,KOMODO_LASTMINED,height);
|
||||||
prevKOMODO_LASTMINED = KOMODO_LASTMINED;
|
prevKOMODO_LASTMINED = KOMODO_LASTMINED;
|
||||||
@@ -879,7 +879,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
|
|||||||
}
|
}
|
||||||
notarized = 1;
|
notarized = 1;
|
||||||
}
|
}
|
||||||
if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
if ( IS_KOMODO_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
||||||
printf("(tx.%d: ",i);
|
printf("(tx.%d: ",i);
|
||||||
for (j=0; j<numvouts; j++)
|
for (j=0; j<numvouts; j++)
|
||||||
{
|
{
|
||||||
@@ -897,7 +897,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
if ( IS_KOMODO_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
||||||
printf("%.8f ",dstr(block.vtx[i].vout[j].nValue));
|
printf("%.8f ",dstr(block.vtx[i].vout[j].nValue));
|
||||||
len = block.vtx[i].vout[j].scriptPubKey.size();
|
len = block.vtx[i].vout[j].scriptPubKey.size();
|
||||||
if ( len >= sizeof(uint32_t) && len <= sizeof(scriptbuf) )
|
if ( len >= sizeof(uint32_t) && len <= sizeof(scriptbuf) )
|
||||||
@@ -916,7 +916,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
if ( IS_KOMODO_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
||||||
printf(") ");
|
printf(") ");
|
||||||
if ( 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
if ( 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
||||||
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d notarized.%d special.%d isratification.%d\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts,notarized,specialtx,isratification);
|
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d notarized.%d special.%d isratification.%d\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts,notarized,specialtx,isratification);
|
||||||
@@ -959,7 +959,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
if ( IS_KOMODO_NOTARY != 0 && ASSETCHAINS_SYMBOL[0] == 0 )
|
||||||
printf("%s ht.%d\n",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL,height);
|
printf("%s ht.%d\n",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL,height);
|
||||||
if ( pindex->nHeight == hwmheight )
|
if ( pindex->nHeight == hwmheight )
|
||||||
komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,(uint32_t)pindex->nTime,0,0,0,0,zero,0);
|
komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,(uint32_t)pindex->nTime,0,0,0,0,zero,0);
|
||||||
|
|||||||
@@ -41,14 +41,14 @@ void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t heig
|
|||||||
{
|
{
|
||||||
static uint32_t counter; int32_t verified=0; char *coin; struct komodo_event_notarized N;
|
static uint32_t counter; int32_t verified=0; char *coin; struct komodo_event_notarized N;
|
||||||
coin = (ASSETCHAINS_SYMBOL[0] == 0) ? (char *)"KMD" : ASSETCHAINS_SYMBOL;
|
coin = (ASSETCHAINS_SYMBOL[0] == 0) ? (char *)"KMD" : ASSETCHAINS_SYMBOL;
|
||||||
if ( (ASSETCHAINS_SYMBOL[0] == 0 && height > 814000) && NOTARY_PUBKEY33[0] != 0 && (verified= komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid)) < 0 )
|
if ( IS_KOMODO_NOTARY != 0 && (verified= komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid)) < 0 )
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_SYMBOL[0] == 0 && height > 814000 && counter++ < 10 )
|
if ( counter++ < 100 )
|
||||||
printf("[%s] error validating notarization ht.%d notarized_height.%d, if on a pruned %s node this can be ignored\n",ASSETCHAINS_SYMBOL,height,notarizedheight,dest);
|
printf("[%s] error validating notarization ht.%d notarized_height.%d, if on a pruned %s node this can be ignored\n",ASSETCHAINS_SYMBOL,height,notarizedheight,dest);
|
||||||
}
|
}
|
||||||
else if ( strcmp(symbol,coin) == 0 )
|
else if ( strcmp(symbol,coin) == 0 )
|
||||||
{
|
{
|
||||||
if ( 0 && NOTARY_PUBKEY33[0] != 0 && verified != 0 )
|
if ( 0 && IS_KOMODO_NOTARY != 0 && verified != 0 )
|
||||||
fprintf(stderr,"validated [%s] ht.%d notarized %d\n",coin,height,notarizedheight);
|
fprintf(stderr,"validated [%s] ht.%d notarized %d\n",coin,height,notarizedheight);
|
||||||
memset(&N,0,sizeof(N));
|
memset(&N,0,sizeof(N));
|
||||||
N.blockhash = notarized_hash;
|
N.blockhash = notarized_hash;
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ int COINBASE_MATURITY = _COINBASE_MATURITY;//100;
|
|||||||
|
|
||||||
int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND;
|
int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE,KOMODO_PAX,KOMODO_EXCHANGEWALLET,KOMODO_REWIND;
|
||||||
int32_t KOMODO_LASTMINED,prevKOMODO_LASTMINED,JUMBLR_PAUSE = 1;
|
int32_t KOMODO_LASTMINED,prevKOMODO_LASTMINED,JUMBLR_PAUSE = 1;
|
||||||
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY;
|
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY,DONATION_PUBKEY;
|
||||||
uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];
|
uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_PUBLIC;
|
||||||
|
|
||||||
char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096];
|
char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096];
|
||||||
uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
|
uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
|
||||||
|
|||||||
@@ -1502,14 +1502,26 @@ char *argv0names[] =
|
|||||||
void komodo_args(char *argv0)
|
void komodo_args(char *argv0)
|
||||||
{
|
{
|
||||||
extern int64_t MAX_MONEY;
|
extern int64_t MAX_MONEY;
|
||||||
|
extern const char *Notaries_elected1[][2];
|
||||||
std::string name,addn; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[256],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,baseid,len,n,extralen = 0;
|
std::string name,addn; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[256],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,baseid,len,n,extralen = 0;
|
||||||
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
||||||
if ( (KOMODO_EXCHANGEWALLET= GetBoolArg("-exchange", false)) != 0 )
|
if ( (KOMODO_EXCHANGEWALLET= GetBoolArg("-exchange", false)) != 0 )
|
||||||
fprintf(stderr,"KOMODO_EXCHANGEWALLET mode active\n");
|
fprintf(stderr,"KOMODO_EXCHANGEWALLET mode active\n");
|
||||||
|
DONATION_PUBKEY = GetArg("-donation", "");
|
||||||
NOTARY_PUBKEY = GetArg("-pubkey", "");
|
NOTARY_PUBKEY = GetArg("-pubkey", "");
|
||||||
if ( strlen(NOTARY_PUBKEY.c_str()) == 66 )
|
if ( strlen(NOTARY_PUBKEY.c_str()) == 66 )
|
||||||
{
|
{
|
||||||
USE_EXTERNAL_PUBKEY = 1;
|
USE_EXTERNAL_PUBKEY = 1;
|
||||||
|
if ( IS_KOMODO_NOTARY == 0 )
|
||||||
|
{
|
||||||
|
for (i=0; i<64; i++)
|
||||||
|
if ( strcmp(NOTARY_PUBKEY.c_str(),Notaries_elected1[i][1]) == 0 )
|
||||||
|
{
|
||||||
|
IS_KOMODO_NOTARY = 1;
|
||||||
|
fprintf(stderr,"running as notary.%d %s\n",i,Notaries_elected1[i][0]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
//KOMODO_PAX = 1;
|
//KOMODO_PAX = 1;
|
||||||
} //else KOMODO_PAX = GetArg("-pax",0);
|
} //else KOMODO_PAX = GetArg("-pax",0);
|
||||||
name = GetArg("-ac_name","");
|
name = GetArg("-ac_name","");
|
||||||
@@ -1528,6 +1540,7 @@ void komodo_args(char *argv0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ASSETCHAINS_CC = GetArg("-ac_cc",0);
|
ASSETCHAINS_CC = GetArg("-ac_cc",0);
|
||||||
|
ASSETCHAINS_PUBLIC = GetArg("-ac_public",0);
|
||||||
if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 )
|
if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 )
|
||||||
{
|
{
|
||||||
printf("KOMODO_REWIND %d\n",KOMODO_REWIND);
|
printf("KOMODO_REWIND %d\n",KOMODO_REWIND);
|
||||||
@@ -1566,7 +1579,7 @@ void komodo_args(char *argv0)
|
|||||||
ASSETCHAINS_COMMISSION = 0;
|
ASSETCHAINS_COMMISSION = 0;
|
||||||
printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY and cant be more than 100000000 (100%%)\n");
|
printf("ASSETCHAINS_COMMISSION needs an ASETCHAINS_OVERRIDE_PUBKEY and cant be more than 100000000 (100%%)\n");
|
||||||
}
|
}
|
||||||
if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_COMMISSION != 0 )
|
if ( ASSETCHAINS_ENDSUBSIDY != 0 || ASSETCHAINS_REWARD != 0 || ASSETCHAINS_HALVING != 0 || ASSETCHAINS_DECAY != 0 || ASSETCHAINS_COMMISSION != 0 || ASSETCHAINS_PUBLIC != 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"end.%llu blocks, reward %.8f halving.%llu blocks, decay.%llu perc %.4f%% ac_pub=[%02x...]\n",(long long)ASSETCHAINS_ENDSUBSIDY,dstr(ASSETCHAINS_REWARD),(long long)ASSETCHAINS_HALVING,(long long)ASSETCHAINS_DECAY,dstr(ASSETCHAINS_COMMISSION)*100,ASSETCHAINS_OVERRIDE_PUBKEY33[0]);
|
fprintf(stderr,"end.%llu blocks, reward %.8f halving.%llu blocks, decay.%llu perc %.4f%% ac_pub=[%02x...]\n",(long long)ASSETCHAINS_ENDSUBSIDY,dstr(ASSETCHAINS_REWARD),(long long)ASSETCHAINS_HALVING,(long long)ASSETCHAINS_DECAY,dstr(ASSETCHAINS_COMMISSION)*100,ASSETCHAINS_OVERRIDE_PUBKEY33[0]);
|
||||||
extraptr = extrabuf;
|
extraptr = extrabuf;
|
||||||
@@ -1575,7 +1588,7 @@ void komodo_args(char *argv0)
|
|||||||
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_REWARD),(void *)&ASSETCHAINS_REWARD);
|
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_REWARD),(void *)&ASSETCHAINS_REWARD);
|
||||||
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_HALVING),(void *)&ASSETCHAINS_HALVING);
|
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_HALVING),(void *)&ASSETCHAINS_HALVING);
|
||||||
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_DECAY),(void *)&ASSETCHAINS_DECAY);
|
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(ASSETCHAINS_DECAY),(void *)&ASSETCHAINS_DECAY);
|
||||||
val = ASSETCHAINS_COMMISSION | (((uint64_t)ASSETCHAINS_STAKED & 0xff) << 32) | (((uint64_t)ASSETCHAINS_CC & 0xffffff) << 40);
|
val = ASSETCHAINS_COMMISSION | (((uint64_t)ASSETCHAINS_STAKED & 0xff) << 32) | (((uint64_t)ASSETCHAINS_CC & 0xffff) << 40) | (ASSETCHAINS_PUBLIC & 0xff);
|
||||||
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(val),(void *)&val);
|
extralen += iguana_rwnum(1,&extraptr[extralen],sizeof(val),(void *)&val);
|
||||||
}
|
}
|
||||||
addn = GetArg("-seednode","");
|
addn = GetArg("-seednode","");
|
||||||
|
|||||||
10
src/main.cpp
10
src/main.cpp
@@ -1109,6 +1109,11 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio
|
|||||||
// Ensure that joinsplit values are well-formed
|
// Ensure that joinsplit values are well-formed
|
||||||
BOOST_FOREACH(const JSDescription& joinsplit, tx.vjoinsplit)
|
BOOST_FOREACH(const JSDescription& joinsplit, tx.vjoinsplit)
|
||||||
{
|
{
|
||||||
|
if ( ASSETCHAINS_PUBLIC != 0 )
|
||||||
|
{
|
||||||
|
return state.DoS(100, error("CheckTransaction(): this is a public chain, no privacy allowed"),
|
||||||
|
REJECT_INVALID, "bad-txns-acprivacy-chain");
|
||||||
|
}
|
||||||
if (joinsplit.vpub_old < 0) {
|
if (joinsplit.vpub_old < 0) {
|
||||||
return state.DoS(100, error("CheckTransaction(): joinsplit.vpub_old negative"),
|
return state.DoS(100, error("CheckTransaction(): joinsplit.vpub_old negative"),
|
||||||
REJECT_INVALID, "bad-txns-vpub_old-negative");
|
REJECT_INVALID, "bad-txns-vpub_old-negative");
|
||||||
@@ -1737,6 +1742,7 @@ bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex,bool checkPOW)
|
|||||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||||
extern uint32_t ASSETCHAINS_MAGIC;
|
extern uint32_t ASSETCHAINS_MAGIC;
|
||||||
extern uint64_t ASSETCHAINS_STAKED,ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_LINEAR,ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY;
|
extern uint64_t ASSETCHAINS_STAKED,ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_LINEAR,ASSETCHAINS_COMMISSION,ASSETCHAINS_SUPPLY;
|
||||||
|
extern uint8_t ASSETCHAINS_PUBLIC;
|
||||||
|
|
||||||
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
|
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
|
||||||
{
|
{
|
||||||
@@ -2952,7 +2958,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
error("ConnectBlock(): coinbase pays too much (actual=%d vs limit=%d)",
|
error("ConnectBlock(): coinbase pays too much (actual=%d vs limit=%d)",
|
||||||
block.vtx[0].GetValueOut(), blockReward),
|
block.vtx[0].GetValueOut(), blockReward),
|
||||||
REJECT_INVALID, "bad-cb-amount");
|
REJECT_INVALID, "bad-cb-amount");
|
||||||
} else if ( NOTARY_PUBKEY33[0] != 0 )
|
} else if ( IS_KOMODO_NOTARY != 0 )
|
||||||
fprintf(stderr,"allow nHeight.%d coinbase %.8f vs %.8f interest %.8f\n",(int32_t)pindex->nHeight,dstr(block.vtx[0].GetValueOut()),dstr(blockReward),dstr(sum));
|
fprintf(stderr,"allow nHeight.%d coinbase %.8f vs %.8f interest %.8f\n",(int32_t)pindex->nHeight,dstr(block.vtx[0].GetValueOut()),dstr(blockReward),dstr(sum));
|
||||||
}
|
}
|
||||||
if (!control.Wait())
|
if (!control.Wait())
|
||||||
@@ -6110,7 +6116,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
}
|
}
|
||||||
pfrom->PushMessage("headers", vHeaders);
|
pfrom->PushMessage("headers", vHeaders);
|
||||||
}
|
}
|
||||||
/*else if ( NOTARY_PUBKEY33[0] != 0 )
|
/*else if ( IS_KOMODO_NOTARY != 0 )
|
||||||
{
|
{
|
||||||
static uint32_t counter;
|
static uint32_t counter;
|
||||||
if ( counter++ < 3 )
|
if ( counter++ < 3 )
|
||||||
|
|||||||
@@ -418,7 +418,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount)
|
|||||||
//pblock->nTime = blocktime + 1;
|
//pblock->nTime = blocktime + 1;
|
||||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
||||||
//LogPrintf("CreateNewBlock(): total size %u blocktime.%u nBits.%08x\n", nBlockSize,blocktime,pblock->nBits);
|
//LogPrintf("CreateNewBlock(): total size %u blocktime.%u nBits.%08x\n", nBlockSize,blocktime,pblock->nBits);
|
||||||
if ( ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_STAKED != 0 && NOTARY_PUBKEY33[0] != 0 )
|
if ( ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_STAKED != 0 && GetArg("-genproclimit", 0) == 0 )
|
||||||
{
|
{
|
||||||
uint64_t txfees,utxovalue; uint32_t txtime; uint256 utxotxid,revtxid; int32_t i,siglen,numsigs,utxovout; uint8_t utxosig[128],*ptr;
|
uint64_t txfees,utxovalue; uint32_t txtime; uint256 utxotxid,revtxid; int32_t i,siglen,numsigs,utxovout; uint8_t utxosig[128],*ptr;
|
||||||
CMutableTransaction txStaked = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1);
|
CMutableTransaction txStaked = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1);
|
||||||
@@ -443,6 +443,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount)
|
|||||||
txNew.vout.resize(1);
|
txNew.vout.resize(1);
|
||||||
txNew.vout[0].scriptPubKey = scriptPubKeyIn;
|
txNew.vout[0].scriptPubKey = scriptPubKeyIn;
|
||||||
txNew.vout[0].nValue = GetBlockSubsidy(nHeight,chainparams.GetConsensus());
|
txNew.vout[0].nValue = GetBlockSubsidy(nHeight,chainparams.GetConsensus());
|
||||||
|
if ( ASSETCHAINS_SYMBOL[0] == 0 && IS_KOMODO_NOTARY != 0 && My_notaryid >= 0 )
|
||||||
|
txNew.vout[0].nValue += 5000;
|
||||||
txNew.nLockTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
txNew.nLockTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
|
||||||
txNew.nExpiryHeight = 0;
|
txNew.nExpiryHeight = 0;
|
||||||
// Add fees
|
// Add fees
|
||||||
@@ -475,14 +477,14 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount)
|
|||||||
// Fill in header
|
// Fill in header
|
||||||
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
|
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
|
||||||
pblock->hashReserved = uint256();
|
pblock->hashReserved = uint256();
|
||||||
if ( ASSETCHAINS_SYMBOL[0] == 0 || ASSETCHAINS_STAKED == 0 || NOTARY_PUBKEY33[0] == 0 )
|
if ( ASSETCHAINS_SYMBOL[0] == 0 || ASSETCHAINS_STAKED == 0 || GetArg("-genproclimit", 0) > 0 )
|
||||||
{
|
{
|
||||||
UpdateTime(pblock, Params().GetConsensus(), pindexPrev);
|
UpdateTime(pblock, Params().GetConsensus(), pindexPrev);
|
||||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
||||||
}
|
}
|
||||||
pblock->nSolution.clear();
|
pblock->nSolution.clear();
|
||||||
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
|
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
|
||||||
if ( ASSETCHAINS_SYMBOL[0] == 0 && NOTARY_PUBKEY33[0] != 0 && My_notaryid >= 0 )
|
if ( ASSETCHAINS_SYMBOL[0] == 0 && IS_KOMODO_NOTARY != 0 && My_notaryid >= 0 )
|
||||||
{
|
{
|
||||||
uint32_t r;
|
uint32_t r;
|
||||||
CMutableTransaction txNotary = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1);
|
CMutableTransaction txNotary = CreateNewContextualCMutableTransaction(Params().GetConsensus(), chainActive.Height() + 1);
|
||||||
@@ -875,7 +877,7 @@ void static BitcoinMiner()
|
|||||||
if ( i == 33 )
|
if ( i == 33 )
|
||||||
externalflag = 1;
|
externalflag = 1;
|
||||||
else externalflag = 0;
|
else externalflag = 0;
|
||||||
if ( NOTARY_PUBKEY33[0] != 0 )
|
if ( IS_KOMODO_NOTARY != 0 )
|
||||||
{
|
{
|
||||||
for (i=1; i<66; i++)
|
for (i=1; i<66; i++)
|
||||||
if ( memcmp(pubkeys[i],pubkeys[0],33) == 0 )
|
if ( memcmp(pubkeys[i],pubkeys[0],33) == 0 )
|
||||||
@@ -909,7 +911,7 @@ void static BitcoinMiner()
|
|||||||
} //else fprintf(stderr,"duplicate at j.%d\n",j);
|
} //else fprintf(stderr,"duplicate at j.%d\n",j);
|
||||||
} else Mining_start = 0;
|
} else Mining_start = 0;
|
||||||
} else Mining_start = 0;
|
} else Mining_start = 0;
|
||||||
if ( ASSETCHAINS_STAKED != 0 && NOTARY_PUBKEY33[0] == 0 )
|
if ( ASSETCHAINS_STAKED != 0 && GetArg("-genproclimit", 0) == 0 )
|
||||||
{
|
{
|
||||||
int32_t percPoS,z;
|
int32_t percPoS,z;
|
||||||
/*if ( Mining_height <= 100 )
|
/*if ( Mining_height <= 100 )
|
||||||
@@ -947,7 +949,7 @@ void static BitcoinMiner()
|
|||||||
// (x_1, x_2, ...) = A(I, V, n, k)
|
// (x_1, x_2, ...) = A(I, V, n, k)
|
||||||
LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString());
|
LogPrint("pow", "Running Equihash solver \"%s\" with nNonce = %s\n",solver, pblock->nNonce.ToString());
|
||||||
arith_uint256 hashTarget;
|
arith_uint256 hashTarget;
|
||||||
if ( NOTARY_PUBKEY33[0] == 0 && ASSETCHAINS_STAKED > 0 && ASSETCHAINS_STAKED < 100 && Mining_height > 10 )
|
if ( GetArg("-genproclimit", 0) > 0 && ASSETCHAINS_STAKED > 0 && ASSETCHAINS_STAKED < 100 && Mining_height > 10 )
|
||||||
hashTarget = HASHTarget_POW;
|
hashTarget = HASHTarget_POW;
|
||||||
else hashTarget = HASHTarget;
|
else hashTarget = HASHTarget;
|
||||||
std::function<bool(std::vector<unsigned char>)> validBlock =
|
std::function<bool(std::vector<unsigned char>)> validBlock =
|
||||||
@@ -975,7 +977,7 @@ void static BitcoinMiner()
|
|||||||
fprintf(stderr," POW\n");*/
|
fprintf(stderr," POW\n");*/
|
||||||
if ( h > hashTarget )
|
if ( h > hashTarget )
|
||||||
return false;
|
return false;
|
||||||
if ( NOTARY_PUBKEY33[0] != 0 && B.nTime > GetAdjustedTime() )
|
if ( B.nTime > GetAdjustedTime() )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"need to wait %d seconds to submit block\n",(int32_t)(B.nTime - GetAdjustedTime()));
|
fprintf(stderr,"need to wait %d seconds to submit block\n",(int32_t)(B.nTime - GetAdjustedTime()));
|
||||||
while ( GetAdjustedTime() < B.nTime-2 )
|
while ( GetAdjustedTime() < B.nTime-2 )
|
||||||
@@ -990,7 +992,7 @@ void static BitcoinMiner()
|
|||||||
}
|
}
|
||||||
if ( ASSETCHAINS_STAKED == 0 )
|
if ( ASSETCHAINS_STAKED == 0 )
|
||||||
{
|
{
|
||||||
if ( NOTARY_PUBKEY33[0] != 0 )
|
if ( IS_KOMODO_NOTARY != 0 )
|
||||||
{
|
{
|
||||||
int32_t r;
|
int32_t r;
|
||||||
if ( (r= ((Mining_height + NOTARY_PUBKEY33[16]) % 64) / 8) > 0 )
|
if ( (r= ((Mining_height + NOTARY_PUBKEY33[16]) % 64) / 8) > 0 )
|
||||||
@@ -999,18 +1001,12 @@ void static BitcoinMiner()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( NOTARY_PUBKEY33[0] != 0 )
|
while ( GetAdjustedTime() < B.nTime )
|
||||||
{
|
sleep(1);
|
||||||
while ( GetAdjustedTime() < B.nTime )
|
uint256 tmp = B.GetHash();
|
||||||
sleep(1);
|
int32_t z; for (z=31; z>=0; z--)
|
||||||
}
|
fprintf(stderr,"%02x",((uint8_t *)&tmp)[z]);
|
||||||
else
|
fprintf(stderr," mined block!\n");
|
||||||
{
|
|
||||||
uint256 tmp = B.GetHash();
|
|
||||||
int32_t z; for (z=31; z>=0; z--)
|
|
||||||
fprintf(stderr,"%02x",((uint8_t *)&tmp)[z]);
|
|
||||||
fprintf(stderr," mined block!\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
CValidationState state;
|
CValidationState state;
|
||||||
if ( !TestBlockValidity(state,B, chainActive.Tip(), true, false))
|
if ( !TestBlockValidity(state,B, chainActive.Tip(), true, false))
|
||||||
@@ -1043,8 +1039,6 @@ void static BitcoinMiner()
|
|||||||
ehSolverRuns.increment();
|
ehSolverRuns.increment();
|
||||||
throw boost::thread_interrupted();
|
throw boost::thread_interrupted();
|
||||||
}
|
}
|
||||||
//if ( ASSETCHAINS_SYMBOL[0] == 0 && NOTARY_PUBKEY33[0] != 0 )
|
|
||||||
// sleep(1800);
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
std::function<bool(EhSolverCancelCheck)> cancelled = [&m_cs, &cancelSolver](EhSolverCancelCheck pos) {
|
std::function<bool(EhSolverCancelCheck)> cancelled = [&m_cs, &cancelSolver](EhSolverCancelCheck pos) {
|
||||||
|
|||||||
@@ -4652,7 +4652,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
|
|||||||
((uint8_t *)&revtxid)[i] = ((uint8_t *)utxotxidp)[31 - i];
|
((uint8_t *)&revtxid)[i] = ((uint8_t *)utxotxidp)[31 - i];
|
||||||
txNew.vin[0].prevout.hash = revtxid;
|
txNew.vin[0].prevout.hash = revtxid;
|
||||||
txNew.vin[0].prevout.n = *utxovoutp;
|
txNew.vin[0].prevout.n = *utxovoutp;
|
||||||
txNew.vout[0].scriptPubKey = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;
|
txNew.vout[0].scriptPubKey = best_scriptPubKey;// CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;
|
||||||
txNew.vout[0].nValue = *utxovaluep - txfee;
|
txNew.vout[0].nValue = *utxovaluep - txfee;
|
||||||
txNew.nLockTime = earliest;
|
txNew.nLockTime = earliest;
|
||||||
CTransaction txNewConst(txNew);
|
CTransaction txNewConst(txNew);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ bool fPayAtLeastCustomFee = true;
|
|||||||
|
|
||||||
extern int32_t KOMODO_EXCHANGEWALLET;
|
extern int32_t KOMODO_EXCHANGEWALLET;
|
||||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||||
|
extern std::string DONATION_PUBKEY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fees smaller than this (in satoshi) are considered zero fee (for transaction creation)
|
* Fees smaller than this (in satoshi) are considered zero fee (for transaction creation)
|
||||||
@@ -2789,6 +2790,15 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
|||||||
//fprintf(stderr,"KOMODO_EXCHANGEWALLET disable interest sum %.8f, interest2 %.8f\n",(double)interest/COIN,(double)interest2/COIN);
|
//fprintf(stderr,"KOMODO_EXCHANGEWALLET disable interest sum %.8f, interest2 %.8f\n",(double)interest/COIN,(double)interest2/COIN);
|
||||||
//interest = 0; // interest2 also
|
//interest = 0; // interest2 also
|
||||||
//}
|
//}
|
||||||
|
if ( ASSETCHAINS_SYMBOL[0] == 0 && DONATION_PUBKEY.size() == 66 && interest2 > 5000 )
|
||||||
|
{
|
||||||
|
CScript scriptDonation = CScript() << ParseHex(DONATION_PUBKEY) << OP_CHECKSIG;
|
||||||
|
CTxOut newTxOut(interest2,scriptDonation);
|
||||||
|
int32_t nDonationPosRet = txNew.vout.size() - 1; // dont change first or last
|
||||||
|
vector<CTxOut>::iterator position = txNew.vout.begin()+nDonationPosRet;
|
||||||
|
txNew.vout.insert(position, newTxOut);
|
||||||
|
interest2 = 0;
|
||||||
|
}
|
||||||
CAmount nChange = (nValueIn - nValue + interest2);
|
CAmount nChange = (nValueIn - nValue + interest2);
|
||||||
//fprintf(stderr,"wallet change %.8f (%.8f - %.8f) interest2 %.8f total %.8f\n",(double)nChange/COIN,(double)nValueIn/COIN,(double)nValue/COIN,(double)interest2/COIN,(double)nTotalValue/COIN);
|
//fprintf(stderr,"wallet change %.8f (%.8f - %.8f) interest2 %.8f total %.8f\n",(double)nChange/COIN,(double)nValueIn/COIN,(double)nValue/COIN,(double)interest2/COIN,(double)nTotalValue/COIN);
|
||||||
if (nSubtractFeeFromAmount == 0)
|
if (nSubtractFeeFromAmount == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user