Merge pull request #612 from jl777/jl777

remove half the redundant windows headers request fix
This commit is contained in:
jl777
2018-04-23 11:01:11 +03:00
committed by GitHub
18 changed files with 89 additions and 67 deletions

View File

@@ -202,7 +202,7 @@ UniValue CallRPC(const string& strMethod, const UniValue& params)
{
std::string host = GetArg("-rpcconnect", "127.0.0.1");
int port = GetArg("-rpcport", BaseParams().RPCPort());
BITCOIND_PORT = port;
BITCOIND_RPCPORT = port;
// Obtain event base
raii_event_base base = obtain_event_base();

View File

@@ -79,7 +79,7 @@ void *chainparams_commandline(void *ptr);
#include "komodo_defs.h"
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern uint16_t ASSETCHAINS_PORT;
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
extern uint32_t ASSETCHAIN_INIT;
extern uint32_t ASSETCHAINS_MAGIC;
extern uint64_t ASSETCHAINS_SUPPLY;
@@ -209,7 +209,7 @@ void CChainParams::SetCheckpointData(CChainParams::CCheckpointData checkpointDat
void *chainparams_commandline(void *ptr)
{
CChainParams::CCheckpointData checkpointData;
while ( ASSETCHAINS_PORT == 0 )
while ( ASSETCHAINS_P2PPORT == 0 )
{
#ifdef _WIN32
boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
@@ -217,15 +217,17 @@ void *chainparams_commandline(void *ptr)
sleep(1);
#endif
}
//fprintf(stderr,">>>>>>>> port.%u\n",ASSETCHAINS_PORT);
//fprintf(stderr,">>>>>>>> port.%u\n",ASSETCHAINS_P2PPORT);
if ( ASSETCHAINS_SYMBOL[0] != 0 )
{
mainParams.SetDefaultPort(ASSETCHAINS_PORT);
mainParams.SetDefaultPort(ASSETCHAINS_P2PPORT);
if ( ASSETCHAINS_RPCPORT == 0 )
ASSETCHAINS_RPCPORT = ASSETCHAINS_P2PPORT + 1;
mainParams.pchMessageStart[0] = ASSETCHAINS_MAGIC & 0xff;
mainParams.pchMessageStart[1] = (ASSETCHAINS_MAGIC >> 8) & 0xff;
mainParams.pchMessageStart[2] = (ASSETCHAINS_MAGIC >> 16) & 0xff;
mainParams.pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff;
fprintf(stderr,">>>>>>>>>> %s: port.%u/%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,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);
checkpointData = //(Checkpoints::CCheckpointData)
{

View File

@@ -11,7 +11,7 @@
#include "chainparams.h"
static const std::string CLIENT_VERSION_STR = FormatVersion(CLIENT_VERSION);
extern char ASSETCHAINS_SYMBOL[];
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
void EnforceNodeDeprecation(int nHeight, bool forceLogging) {

View File

@@ -504,7 +504,7 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t
uint256 hash; char params[128],*hexstr,*jsonstr; cJSON *result; int32_t i; uint8_t revbuf[32];
memset(&hash,0,sizeof(hash));
sprintf(params,"[%d]",height);
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,BITCOIND_PORT)) != 0 )
if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,BITCOIND_RPCPORT)) != 0 )
{
if ( (result= cJSON_Parse(jsonstr)) != 0 )
{

View File

@@ -51,13 +51,13 @@ std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES,ASSETCHAINS_OVERRIDE_PUBKEY;
uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];
char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN],ASSETCHAINS_USERPASS[4096];
uint16_t ASSETCHAINS_PORT;
uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC;
uint32_t ASSETCHAINS_MAGIC = 2387029918;
uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_DECAY,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED,ASSETCHAINS_SUPPLY = 10;
uint32_t KOMODO_INITDONE;
char KMDUSERPASS[4096],BTCUSERPASS[4096]; uint16_t KMD_PORT = 7771,BITCOIND_PORT = 7771;
char KMDUSERPASS[4096],BTCUSERPASS[4096]; uint16_t KMD_PORT = 7771,BITCOIND_RPCPORT = 7771;
uint64_t PENDING_KOMODO_TX;
extern int32_t KOMODO_LOADINGBLOCKS;

View File

@@ -83,7 +83,7 @@ char *jumblr_importaddress(char *address)
{
char params[1024];
sprintf(params,"[\"%s\", \"%s\", false]",address,address);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"importaddress",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"importaddress",params,BITCOIND_RPCPORT));
}
char *jumblr_validateaddress(char *addr)
@@ -91,7 +91,7 @@ char *jumblr_validateaddress(char *addr)
char params[1024];
sprintf(params,"[\"%s\"]",addr);
printf("validateaddress.%s\n",params);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"validateaddress",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"validateaddress",params,BITCOIND_RPCPORT));
}
int32_t Jumblr_secretaddrfind(char *searchaddr)
@@ -222,28 +222,28 @@ char *jumblr_zgetnewaddress()
{
char params[1024];
sprintf(params,"[]");
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getnewaddress",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getnewaddress",params,BITCOIND_RPCPORT));
}
char *jumblr_zlistoperationids()
{
char params[1024];
sprintf(params,"[]");
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listoperationids",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listoperationids",params,BITCOIND_RPCPORT));
}
char *jumblr_zgetoperationresult(char *opid)
{
char params[1024];
sprintf(params,"[[\"%s\"]]",opid);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationresult",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationresult",params,BITCOIND_RPCPORT));
}
char *jumblr_zgetoperationstatus(char *opid)
{
char params[1024];
sprintf(params,"[[\"%s\"]]",opid);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationstatus",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getoperationstatus",params,BITCOIND_RPCPORT));
}
char *jumblr_sendt_to_z(char *taddr,char *zaddr,double amount)
@@ -253,7 +253,7 @@ char *jumblr_sendt_to_z(char *taddr,char *zaddr,double amount)
return(clonestr((char *)"{\"error\":\"illegal address in t to z\"}"));
sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}, {\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",taddr,zaddr,amount-fee-JUMBLR_TXFEE,JUMBLR_ADDR,fee,JUMBLR_TXFEE);
printf("t -> z: %s\n",params);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_RPCPORT));
}
char *jumblr_sendz_to_z(char *zaddrS,char *zaddrD,double amount)
@@ -264,7 +264,7 @@ char *jumblr_sendz_to_z(char *zaddrS,char *zaddrD,double amount)
//sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}, {\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddrS,zaddrD,amount-fee-JUMBLR_TXFEE,JUMBLR_ADDR,fee,JUMBLR_TXFEE);
sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddrS,zaddrD,amount-fee-JUMBLR_TXFEE,JUMBLR_TXFEE);
printf("z -> z: %s\n",params);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_RPCPORT));
}
char *jumblr_sendz_to_t(char *zaddr,char *taddr,double amount)
@@ -274,56 +274,56 @@ char *jumblr_sendz_to_t(char *zaddr,char *taddr,double amount)
return(clonestr((char *)"{\"error\":\"illegal address in z to t\"}"));
sprintf(params,"[\"%s\", [{\"address\":\"%s\",\"amount\":%.8f}, {\"address\":\"%s\",\"amount\":%.8f}], 1, %.8f]",zaddr,taddr,amount-fee-JUMBLR_TXFEE,JUMBLR_ADDR,fee,JUMBLR_TXFEE);
printf("z -> t: %s\n",params);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_sendmany",params,BITCOIND_RPCPORT));
}
char *jumblr_zlistaddresses()
{
char params[1024];
sprintf(params,"[]");
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listaddresses",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listaddresses",params,BITCOIND_RPCPORT));
}
char *jumblr_zlistreceivedbyaddress(char *addr)
{
char params[1024];
sprintf(params,"[\"%s\", 1]",addr);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listreceivedbyaddress",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_listreceivedbyaddress",params,BITCOIND_RPCPORT));
}
char *jumblr_getreceivedbyaddress(char *addr)
{
char params[1024];
sprintf(params,"[\"%s\", 1]",addr);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"getreceivedbyaddress",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"getreceivedbyaddress",params,BITCOIND_RPCPORT));
}
char *jumblr_importprivkey(char *wifstr)
{
char params[1024];
sprintf(params,"[\"%s\", \"\", false]",wifstr);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"importprivkey",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"importprivkey",params,BITCOIND_RPCPORT));
}
char *jumblr_zgetbalance(char *addr)
{
char params[1024];
sprintf(params,"[\"%s\", 1]",addr);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getbalance",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"z_getbalance",params,BITCOIND_RPCPORT));
}
char *jumblr_listunspent(char *coinaddr)
{
char params[1024];
sprintf(params,"[1, 99999999, [\"%s\"]]",coinaddr);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"listunspent",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"listunspent",params,BITCOIND_RPCPORT));
}
char *jumblr_gettransaction(char *txidstr)
{
char params[1024];
sprintf(params,"[\"%s\", 1]",txidstr);
return(jumblr_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,BITCOIND_PORT));
return(jumblr_issuemethod(KMDUSERPASS,(char *)"getrawtransaction",params,BITCOIND_RPCPORT));
}
int32_t jumblr_numvins(bits256 txid)

View File

@@ -1263,7 +1263,7 @@ void iguana_initQ(queue_t *Q,char *name)
free(item);
}
uint16_t komodo_userpass(char *username,char *password,FILE *fp)
uint16_t _komodo_userpass(char *username,char *password,FILE *fp)
{
char *rpcuser,*rpcpassword,*str,line[8192]; uint16_t port = 0;
rpcuser = rpcpassword = 0;
@@ -1280,7 +1280,7 @@ uint16_t komodo_userpass(char *username,char *password,FILE *fp)
else if ( (str= strstr(line,(char *)"rpcport")) != 0 )
{
port = atoi(parse_conf_line(str,(char *)"rpcport"));
//printf("rpcport.%u in file\n",port);
//fprintf(stderr,"rpcport.%u in file\n",port);
}
}
if ( rpcuser != 0 && rpcpassword != 0 )
@@ -1333,11 +1333,11 @@ void komodo_statefname(char *fname,char *symbol,char *str)
//printf("test.(%s) -> [%s] statename.(%s) %s\n",test,ASSETCHAINS_SYMBOL,symbol,fname);
}
void komodo_configfile(char *symbol,uint16_t port)
void komodo_configfile(char *symbol,uint16_t rpcport)
{
static char myusername[512],mypassword[8192];
FILE *fp; uint16_t kmdport; uint8_t buf2[33]; char fname[512],buf[128],username[512],password[8192]; uint32_t crc,r,r2,i;
if ( symbol != 0 && port != 0 )
if ( symbol != 0 && rpcport != 0 )
{
r = (uint32_t)time(NULL);
r2 = OS_milliseconds();
@@ -1354,7 +1354,7 @@ void komodo_configfile(char *symbol,uint16_t port)
sprintf(&password[i*2],"%02x",buf2[i]);
password[i*2] = 0;
sprintf(buf,"%s.conf",symbol);
BITCOIND_PORT = port;
BITCOIND_RPCPORT = rpcport;
#ifdef _WIN32
sprintf(fname,"%s\\%s",GetDataDir(false).string().c_str(),buf);
#else
@@ -1365,7 +1365,7 @@ void komodo_configfile(char *symbol,uint16_t port)
#ifndef FROM_CLI
if ( (fp= fopen(fname,"wb")) != 0 )
{
fprintf(fp,"rpcuser=user%u\nrpcpassword=pass%s\nrpcport=%u\nserver=1\ntxindex=1\nrpcworkqueue=256\nrpcallowip=127.0.0.1\n",crc,password,port);
fprintf(fp,"rpcuser=user%u\nrpcpassword=pass%s\nrpcport=%u\nserver=1\ntxindex=1\nrpcworkqueue=256\nrpcallowip=127.0.0.1\n",crc,password,rpcport);
fclose(fp);
printf("Created (%s)\n",fname);
} else printf("Couldnt create (%s)\n",fname);
@@ -1373,7 +1373,7 @@ void komodo_configfile(char *symbol,uint16_t port)
}
else
{
komodo_userpass(myusername,mypassword,fp);
_komodo_userpass(myusername,mypassword,fp);
mapArgs["-rpcpassword"] = mypassword;
mapArgs["-rpcusername"] = myusername;
//fprintf(stderr,"myusername.(%s)\n",myusername);
@@ -1396,7 +1396,7 @@ void komodo_configfile(char *symbol,uint16_t port)
#endif
if ( (fp= fopen(fname,"rb")) != 0 )
{
if ( (kmdport= komodo_userpass(username,password,fp)) != 0 )
if ( (kmdport= _komodo_userpass(username,password,fp)) != 0 )
KMD_PORT = kmdport;
sprintf(KMDUSERPASS,"%s:%s",username,password);
fclose(fp);
@@ -1420,12 +1420,11 @@ uint16_t komodo_userpass(char *userpass,char *symbol)
komodo_statefname(fname,symbol,confname);
if ( (fp= fopen(fname,"rb")) != 0 )
{
port = komodo_userpass(username,password,fp);
port = _komodo_userpass(username,password,fp);
sprintf(userpass,"%s:%s",username,password);
if ( strcmp(symbol,ASSETCHAINS_SYMBOL) == 0 )
strcpy(ASSETCHAINS_USERPASS,userpass);
fclose(fp);
return((int32_t)strlen(userpass));
}
return(port);
}
@@ -1503,7 +1502,7 @@ char *argv0names[] =
void komodo_args(char *argv0)
{
extern int64_t MAX_MONEY;
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; 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);
if ( (KOMODO_EXCHANGEWALLET= GetBoolArg("-exchange", false)) != 0 )
fprintf(stderr,"KOMODO_EXCHANGEWALLET mode active\n");
@@ -1581,7 +1580,7 @@ void komodo_args(char *argv0)
addn = GetArg("-seednode","");
if ( strlen(addn.c_str()) > 0 )
ASSETCHAINS_SEED = 1;
strncpy(ASSETCHAINS_SYMBOL,name.c_str(),sizeof(ASSETCHAINS_SYMBOL)-1);
strncpy(ASSETCHAINS_SYMBOL,name.c_str(),64);
if ( (baseid= komodo_baseid(ASSETCHAINS_SYMBOL)) >= 0 && baseid < 32 )
MAX_MONEY = komodo_maxallowed(baseid);
else if ( ASSETCHAINS_REWARD == 0 )
@@ -1589,7 +1588,7 @@ void komodo_args(char *argv0)
else MAX_MONEY = (ASSETCHAINS_SUPPLY+1) * SATOSHIDEN + ASSETCHAINS_REWARD * (ASSETCHAINS_ENDSUBSIDY==0 ? 10000000 : ASSETCHAINS_ENDSUBSIDY);
MAX_MONEY += (MAX_MONEY * ASSETCHAINS_COMMISSION) / SATOSHIDEN;
//printf("baseid.%d MAX_MONEY.%s %.8f\n",baseid,ASSETCHAINS_SYMBOL,(double)MAX_MONEY/SATOSHIDEN);
ASSETCHAINS_PORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen);
ASSETCHAINS_P2PPORT = komodo_port(ASSETCHAINS_SYMBOL,ASSETCHAINS_SUPPLY,&ASSETCHAINS_MAGIC,extraptr,extralen);
while ( (dirname= (char *)GetDataDir(false).string().c_str()) == 0 || dirname[0] == 0 )
{
fprintf(stderr,"waiting for datadir\n");
@@ -1604,11 +1603,14 @@ void komodo_args(char *argv0)
{
int32_t komodo_baseid(char *origbase);
extern int COINBASE_MATURITY;
komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1);
komodo_userpass(ASSETCHAINS_USERPASS,ASSETCHAINS_SYMBOL);
if ( (port= komodo_userpass(ASSETCHAINS_USERPASS,ASSETCHAINS_SYMBOL)) != 0 )
ASSETCHAINS_RPCPORT = port;
else komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_P2PPORT + 1);
COINBASE_MATURITY = 1;
//fprintf(stderr,"ASSETCHAINS_PORT %s %u (%s)\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_USERPASS);
//fprintf(stderr,"ASSETCHAINS_RPCPORT (%s) %u\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_RPCPORT);
}
if ( ASSETCHAINS_RPCPORT == 0 )
ASSETCHAINS_RPCPORT = ASSETCHAINS_P2PPORT + 1;
//ASSETCHAINS_NOTARIES = GetArg("-ac_notaries","");
//komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str());
iguana_rwnum(1,magic,sizeof(ASSETCHAINS_MAGIC),(void *)&ASSETCHAINS_MAGIC);
@@ -1619,7 +1621,7 @@ void komodo_args(char *argv0)
sprintf(fname,"gen%s",ASSETCHAINS_SYMBOL);
if ( (fp= fopen(fname,"wb")) != 0 )
{
fprintf(fp,iguanafmtstr,name.c_str(),name.c_str(),name.c_str(),name.c_str(),magicstr,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,"78.47.196.146");
fprintf(fp,iguanafmtstr,name.c_str(),name.c_str(),name.c_str(),name.c_str(),magicstr,ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT,"78.47.196.146");
fclose(fp);
//printf("created (%s)\n",fname);
} else printf("error creating (%s)\n",fname);
@@ -1628,7 +1630,8 @@ void komodo_args(char *argv0)
else
{
char fname[512],username[512],password[4096]; int32_t iter; FILE *fp;
ASSETCHAINS_PORT = 8777;
ASSETCHAINS_P2PPORT = 7770;
ASSETCHAINS_RPCPORT = 7771;
for (iter=0; iter<2; iter++)
{
strcpy(fname,GetDataDir().string().c_str());
@@ -1653,7 +1656,7 @@ void komodo_args(char *argv0)
#endif
if ( (fp= fopen(fname,"rb")) != 0 )
{
komodo_userpass(username,password,fp);
_komodo_userpass(username,password,fp);
sprintf(iter == 0 ? KMDUSERPASS : BTCUSERPASS,"%s:%s",username,password);
fclose(fp);
//printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS);
@@ -1662,8 +1665,11 @@ void komodo_args(char *argv0)
break;
}
}
BITCOIND_PORT = GetArg("-rpcport", BaseParams().RPCPort());
//fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL);
if ( ASSETCHAINS_SYMBOL[0] != 0 )
{
BITCOIND_RPCPORT = GetArg("-rpcport", ASSETCHAINS_RPCPORT);
//fprintf(stderr,"(%s) port.%u chain params initialized\n",ASSETCHAINS_SYMBOL,BITCOIND_RPCPORT);
} else BITCOIND_RPCPORT = GetArg("-rpcport", BaseParams().RPCPort());
}
void komodo_nameset(char *symbol,char *dest,char *source)

View File

@@ -3855,7 +3855,7 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat
// Check transactions
BOOST_FOREACH(const CTransaction& tx, block.vtx)
{
if ( komodo_validate_interest(tx,height == 0 ? komodo_block2height((CBlock *)&block) : height,block.nTime,1) < 0 )
if ( komodo_validate_interest(tx,height == 0 ? komodo_block2height((CBlock *)&block) : height,block.nTime,0) < 0 )
return error("CheckBlock: komodo_validate_interest failed");
if (!CheckTransaction(tx, state, verifier))
return error("CheckBlock: CheckTransaction failed");
@@ -4009,7 +4009,8 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock);
if (mi == mapBlockIndex.end())
{
fprintf(stderr,"AcceptBlockHeader prev block not found\n");
fprintf(stderr,"AcceptBlockHeader hashPrevBlock %s not found\n",block.hashPrevBlock.ToString().c_str());
// request block.hashPrevBlock
return(false);
//return state.DoS(10, error("%s: prev block not found", __func__), 0, "bad-prevblk");
}
@@ -4137,6 +4138,15 @@ CBlockIndex *komodo_ensure(CBlock *pblock,uint256 hash)
miSelf->second = AddToBlockIndex(*pblock);
//fprintf(stderr,"Block header %s is already known, but without pindex -> ensured %p\n",hash.ToString().c_str(),miSelf->second);
}
/*if ( hash != chainparams.GetConsensus().hashGenesisBlock )
{
miSelf = mapBlockIndex.find(pblock->hashPrevBlock);
if ( miSelf == mapBlockIndex.end() )
{
miSelf->second = InsertBlockIndex(pblock->hashPrevBlock);
fprintf(stderr,"autocreate previndex %s\n",pblock->hashPrevBlock.ToString().c_str());
}
}*/
}
}
@@ -5845,7 +5855,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
vector<CBlock> vHeaders;
int nLimit = MAX_HEADERS_RESULTS;
LogPrint("net", "getheaders %d to %s from peer=%d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString(), pfrom->id);
if ( pfrom->lasthdrsreq >= chainActive.Height()-MAX_HEADERS_RESULTS || pfrom->lasthdrsreq != (int32_t)(pindex ? pindex->nHeight : -1) )
//if ( pfrom->lasthdrsreq >= chainActive.Height()-MAX_HEADERS_RESULTS || pfrom->lasthdrsreq != (int32_t)(pindex ? pindex->nHeight : -1) )// no need to ever suppress this
{
pfrom->lasthdrsreq = (int32_t)(pindex ? pindex->nHeight : -1);
for (; pindex; pindex = chainActive.Next(pindex))
@@ -5856,12 +5866,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
pfrom->PushMessage("headers", vHeaders);
}
else if ( NOTARY_PUBKEY33[0] != 0 )
/*else if ( NOTARY_PUBKEY33[0] != 0 )
{
static uint32_t counter;
if ( counter++ < 3 )
fprintf(stderr,"you can ignore redundant getheaders from peer.%d %d prev.%d\n",(int32_t)pfrom->id,(int32_t)(pindex ? pindex->nHeight : -1),pfrom->lasthdrsreq);
}
}*/
}

View File

@@ -53,7 +53,7 @@ void TxConfirmStats::ClearCurrent(unsigned int nBlockHeight)
unsigned int TxConfirmStats::FindBucketIndex(double val)
{
extern char ASSETCHAINS_SYMBOL[];
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
auto it = bucketMap.lower_bound(val);
if ( it != bucketMap.end() )
{

View File

@@ -123,7 +123,7 @@ CBlockIndex *komodo_chainactive(int32_t height);
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height);
extern int32_t KOMODO_CHOSEN_ONE;
extern uint64_t ASSETCHAINS_STAKED;
extern char ASSETCHAINS_SYMBOL[];
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
#define KOMODO_ELECTION_GAP 2000
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blocktimes[66],int32_t *nonzpkeysp,int32_t height);

View File

@@ -264,7 +264,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
if (wtx.IsCoinBase())
{
extern char ASSETCHAINS_SYMBOL[];
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
if ( ASSETCHAINS_SYMBOL[0] == 0 )
COINBASE_MATURITY = _COINBASE_MATURITY;
quint32 numBlocksToMaturity = COINBASE_MATURITY + 1;

View File

@@ -50,10 +50,10 @@ int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp);
uint32_t komodo_chainactive_timestamp();
int32_t komodo_whoami(char *pubkeystr,int32_t height,uint32_t timestamp);
extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE;
extern char ASSETCHAINS_SYMBOL[];
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp);
#define KOMODO_VERSION "0.1.1"
extern uint16_t ASSETCHAINS_PORT;
extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
extern uint32_t ASSETCHAINS_CC;
extern uint32_t ASSETCHAINS_MAGIC;
extern uint64_t ASSETCHAINS_ENDSUBSIDY,ASSETCHAINS_REWARD,ASSETCHAINS_HALVING,ASSETCHAINS_DECAY,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED,ASSETCHAINS_SUPPLY;
@@ -155,10 +155,12 @@ UniValue getinfo(const UniValue& params, bool fHelp)
}
if ( ASSETCHAINS_CC != 0 )
obj.push_back(Pair("CCid", (int)ASSETCHAINS_CC));
obj.push_back(Pair("name", ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL));
if ( ASSETCHAINS_SYMBOL[0] != 0 )
{
obj.push_back(Pair("name", ASSETCHAINS_SYMBOL));
obj.push_back(Pair("port", ASSETCHAINS_PORT));
//obj.push_back(Pair("name", ASSETCHAINS_SYMBOL));
obj.push_back(Pair("p2pport", ASSETCHAINS_P2PPORT));
obj.push_back(Pair("rpcport", ASSETCHAINS_RPCPORT));
obj.push_back(Pair("magic", (int)ASSETCHAINS_MAGIC));
if ( ASSETCHAINS_SUPPLY != 0 )
obj.push_back(Pair("premine", ASSETCHAINS_SUPPLY));

View File

@@ -238,7 +238,7 @@ UniValue help(const UniValue& params, bool fHelp)
return tableRPC.help(strCommand);
}
extern char ASSETCHAINS_SYMBOL[];
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
UniValue stop(const UniValue& params, bool fHelp)
{

View File

@@ -315,7 +315,7 @@ void CTxMemPool::remove(const CTransaction &origTx, std::list<CTransaction>& rem
void CTxMemPool::removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight, int flags)
{
// Remove transactions spending a coinbase which are now immature
extern char ASSETCHAINS_SYMBOL[];
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
if ( ASSETCHAINS_SYMBOL[0] == 0 )
COINBASE_MATURITY = _COINBASE_MATURITY;
// Remove transactions spending a coinbase which are now immature and no-longer-final transactions

View File

@@ -644,9 +644,8 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
}
// If datadir is changed in .conf file:
ClearDatadirCache();
extern uint16_t BITCOIND_PORT;
BITCOIND_PORT = GetArg("-rpcport",BaseParams().RPCPort());
//fprintf(stderr,"from conf file %s RPC %u, used to be %u\n",ASSETCHAINS_SYMBOL,BITCOIND_PORT,BITCOIND_PORT);
extern uint16_t BITCOIND_RPCPORT;
BITCOIND_RPCPORT = GetArg("-rpcport",BaseParams().RPCPort());
}
#ifndef _WIN32

View File

@@ -257,4 +257,7 @@ template <typename Callable> void TraceThread(const char* name, Callable func)
}
}
#define KOMODO_ASSETCHAIN_MAXLEN 65
#endif // BITCOIN_UTIL_H

View File

@@ -12,8 +12,8 @@
char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
int64_t MAX_MONEY = 200000000 * 100000000LL;
uint64_t ASSETCHAINS_SUPPLY;
uint16_t BITCOIND_PORT = 7771;
uint16_t ASSETCHAINS_PORT;
uint16_t BITCOIND_RPCPORT = 7771;
uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT;
uint32_t ASSETCHAIN_INIT,ASSETCHAINS_CC;
uint32_t ASSETCHAINS_MAGIC = 2387029918;

View File

@@ -10,7 +10,7 @@
#include "komodo_defs.h"
char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
int64_t MAX_MONEY = 200000000 * 100000000LL;
uint16_t BITCOIND_PORT = 7771;
uint16_t BITCOIND_RPCPORT = 7771;
uint32_t ASSETCHAINS_CC = 0;
using namespace libzcash;