@@ -16,7 +16,8 @@ echo $pubkey
|
||||
./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=78.47.196.146 $1 &
|
||||
./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=78.47.196.146 $1 &
|
||||
./komodod -pubkey=$pubkey -ac_name=MVP -ac_supply=1000000 -addnode=78.47.196.146 $1 &
|
||||
./komodod -pubkey=$pubkey -ac_name=WIRELESS -ac_supply=21000000 -addnode=78.47.196.146 $1 &
|
||||
#./komodod -pubkey=$pubkey -ac_name=WIRELESS -ac_supply=21000000 -addnode=78.47.196.146 $1 &
|
||||
./komodod -pubkey=$pubkey -ac_name=WLC -ac_supply=210000000 -addnode=148.251.190.89 $1 &
|
||||
./komodod -pubkey=$pubkey -ac_name=KV -ac_supply=1000000 -addnode=78.47.196.146 $1 &
|
||||
./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=78.47.196.146 $1 &
|
||||
./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000000 -addnode=78.47.196.146 $1 &
|
||||
|
||||
@@ -17,7 +17,7 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BOTS\",\"pubkey\":\"$pubkey\"}"
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MGW\",\"pubkey\":\"$pubkey\"}"
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MVP\",\"pubkey\":\"$pubkey\"}"
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"WIRELESS\",\"pubkey\":\"$pubkey\"}"
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"WLC\",\"pubkey\":\"$pubkey\"}"
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KV\",\"pubkey\":\"$pubkey\"}"
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CEAL\",\"pubkey\":\"$pubkey\"}"
|
||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MESH\",\"pubkey\":\"$pubkey\"}"
|
||||
|
||||
@@ -44,7 +44,7 @@ echo shark; fiat/shark $1 $2 $3 $4
|
||||
echo bots; fiat/bots $1 $2 $3 $4
|
||||
echo mgw; fiat/mgw $1 $2 $3 $4
|
||||
echo mvp; fiat/mvp $1 $2 $3 $4
|
||||
echo wireless; fiat/wireless $1 $2 $3 $4
|
||||
echo wlc; fiat/wlc $1 $2 $3 $4
|
||||
echo kv; fiat/kv $1 $2 $3 $4
|
||||
echo ceal; fiat/ceal $1 $2 $3 $4
|
||||
echo mesh; fiat/mesh $1 $2 $3 $4
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
./komodo-cli -ac_name=WIRELESS $1 $2 $3 $4 $5 $6
|
||||
2
src/fiat/wlc
Executable file
2
src/fiat/wlc
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
./komodo-cli -ac_name=WLC $1 $2 $3 $4 $5 $6
|
||||
@@ -346,6 +346,60 @@ char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port)
|
||||
return(retstr2);
|
||||
}
|
||||
|
||||
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp)
|
||||
{
|
||||
char *jsonstr,params[256],*userpass; uint16_t port; cJSON *json,*item; int32_t height = 0,txid_height = 0,txid_confirmations = 0;
|
||||
params[0] = 0;
|
||||
*kmdnotarized_heightp = 0;
|
||||
if ( strcmp(dest,"KMD") == 0 )
|
||||
{
|
||||
port = 7771;
|
||||
userpass = KMDUSERPASS;
|
||||
}
|
||||
else if ( strcmp(dest,"BTC") == 0 )
|
||||
{
|
||||
port = 8332;
|
||||
userpass = BTCUSERPASS;
|
||||
}
|
||||
else return(0);
|
||||
if ( userpass[0] != 0 )
|
||||
{
|
||||
if ( (jsonstr= komodo_issuemethod(userpass,(char *)"getinfo",params,port)) != 0 )
|
||||
{
|
||||
//printf("(%s)\n",jsonstr);
|
||||
if ( (json= cJSON_Parse(jsonstr)) != 0 )
|
||||
{
|
||||
if ( (item= jobj(json,(char *)"result")) != 0 )
|
||||
{
|
||||
height = jint(item,(char *)"blocks");
|
||||
*kmdnotarized_heightp = strcmp(dest,"KMD") == 0 ? jint(item,(char *)"notarized") : height;
|
||||
}
|
||||
free_json(json);
|
||||
}
|
||||
free(jsonstr);
|
||||
}
|
||||
sprintf(params,"[\"%s\", 1]",txidstr);
|
||||
if ( (jsonstr= komodo_issuemethod(userpass,(char *)"getrawtransaction",params,port)) != 0 )
|
||||
{
|
||||
//printf("(%s)\n",jsonstr);
|
||||
if ( (json= cJSON_Parse(jsonstr)) != 0 )
|
||||
{
|
||||
if ( (item= jobj(json,(char *)"result")) != 0 )
|
||||
{
|
||||
txid_confirmations = jint(item,(char *)"confirmations");
|
||||
if ( txid_confirmations > 0 && height > txid_confirmations )
|
||||
txid_height = height - txid_confirmations;
|
||||
else txid_height = height;
|
||||
//printf("height.%d tconfs.%d txid_height.%d\n",height,txid_confirmations,txid_height);
|
||||
}
|
||||
free_json(json);
|
||||
}
|
||||
free(jsonstr);
|
||||
}
|
||||
}
|
||||
return(txid_height);
|
||||
}
|
||||
|
||||
int32_t komodo_verifynotarizedscript(int32_t height,uint8_t *script,int32_t len,uint256 NOTARIZED_HASH)
|
||||
{
|
||||
int32_t i; uint256 hash; char params[256];
|
||||
@@ -818,7 +872,7 @@ int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_
|
||||
{
|
||||
if ( tx.nLockTime != 1477258935 || dispflag != 0 )
|
||||
{
|
||||
fprintf(stderr,"komodo_validate_interest.%d reject.%d [%d] locktime %u cmp2.%u\n",dispflag,txheight,(int32_t)(tx.nLockTime - (cmptime-3600)),(uint32_t)tx.nLockTime,cmptime);
|
||||
//fprintf(stderr,"komodo_validate_interest.%d reject.%d [%d] locktime %u cmp2.%u\n",dispflag,txheight,(int32_t)(tx.nLockTime - (cmptime-3600)),(uint32_t)tx.nLockTime,cmptime);
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,10 @@ void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t heig
|
||||
{
|
||||
struct komodo_event_notarized N;
|
||||
if ( komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid) != 0 )
|
||||
printf("[%s] error validating notarization ht.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,height,notarizedheight);
|
||||
{
|
||||
if ( height > 50000 )
|
||||
printf("[%s] error validating notarization ht.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,height,notarizedheight);
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&N,0,sizeof(N));
|
||||
|
||||
@@ -584,7 +584,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
|
||||
PENDING_KOMODO_TX += pax->komodoshis;
|
||||
printf(" len.%d vout.%u DEPOSIT %.8f <- pax.%s pending ht %d %d %.8f | ",len,pax->vout,(double)txNew->vout[numvouts].nValue/COIN,symbol,pax->height,pax->otherheight,dstr(PENDING_KOMODO_TX));
|
||||
}
|
||||
if ( numvouts++ >= 64 )
|
||||
if ( numvouts++ >= 64 || sum > COIN )
|
||||
break;
|
||||
}
|
||||
if ( numvouts > 1 )
|
||||
@@ -652,7 +652,8 @@ void komodo_passport_iteration();
|
||||
int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above block is valid pax pricing
|
||||
{
|
||||
static uint256 array[64]; static int32_t numbanned,indallvouts;
|
||||
int32_t i,j,k,n,ht,baseid,txn_count,num,opretlen,offset=1,errs=0,matched=0,kmdheights[64],otherheights[64]; uint256 hash,txids[64]; char symbol[16],base[16]; uint16_t vouts[64]; int8_t baseids[64]; uint8_t *script,opcode,rmd160s[64*20]; uint64_t total,available,deposited,issued,withdrawn,approved,redeemed; int64_t values[64],srcvalues[64]; struct pax_transaction *pax; struct komodo_state *sp;
|
||||
int32_t i,j,k,n,ht,baseid,txn_count,activation,num,opretlen,offset=1,errs=0,matched=0,kmdheights[64],otherheights[64]; uint256 hash,txids[64]; char symbol[16],base[16]; uint16_t vouts[64]; int8_t baseids[64]; uint8_t *script,opcode,rmd160s[64*20]; uint64_t total,available,deposited,issued,withdrawn,approved,redeemed,checktoshis,seed; int64_t values[64],srcvalues[64]; struct pax_transaction *pax; struct komodo_state *sp;
|
||||
activation = 235300;
|
||||
if ( *(int32_t *)&array[0] == 0 )
|
||||
numbanned = komodo_bannedset(&indallvouts,array,(int32_t)(sizeof(array)/sizeof(*array)));
|
||||
memset(baseids,0xff,sizeof(baseids));
|
||||
@@ -706,7 +707,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
||||
if ( overflow != 0 || total > COIN/10 )
|
||||
{
|
||||
//fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",height,dstr(block.vtx[0].vout[1].nValue),n);
|
||||
if ( height >= 235300 )
|
||||
if ( height >= activation )
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
@@ -721,17 +722,6 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
||||
offset += komodo_scriptitemlen(&opretlen,&script[offset]);
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||
{
|
||||
/*extern int32_t KOMODO_REWIND;
|
||||
if ( KOMODO_REWIND < 0 )
|
||||
{
|
||||
fprintf(stderr,">>>>>>> rewind.%d will pause here for a minute. issue command and stop\n",KOMODO_REWIND);
|
||||
sleep(60);
|
||||
KOMODO_REWIND = 0;
|
||||
}*/
|
||||
// 6a35506c65617365206d616b6520796f75722047697420636f6d6d6974206d65737361676573206d6f726520696e74657265737469 height.241778 checkdeposit n.4 [6a] [P] 80 vs 88
|
||||
//for (i=0; i<opretlen; i++)
|
||||
// printf("%02x",script[i]);
|
||||
//printf(" height.%d checkdeposit n.%d [%02x] [%c] %d vs %d\n",height,n,script[0],script[offset],script[offset],'X');
|
||||
opcode = 'X';
|
||||
if ( height >= 235300 )
|
||||
return(-1);
|
||||
@@ -949,7 +939,17 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
||||
{
|
||||
}
|
||||
if ( strcmp(ASSETCHAINS_SYMBOL,CURRENCIES[baseids[i-1]]) == 0 )
|
||||
printf("check deposit validates %s.%d [%d] %.8f -> %.8f (%.8f %.8f %.8f)\n",CURRENCIES[baseids[i-1]],height,i,dstr(srcvalues[i-1]),dstr(values[i-1]),dstr(pax->komodoshis),dstr(pax->fiatoshis),dstr(block.vtx[0].vout[i].nValue));
|
||||
{
|
||||
//check deposit validates AUD.1047 [3] 0.14585530 -> 0.01000000 (0.14585530 0.01000000 0.01000000)
|
||||
char destaddr[64],coinaddr[64]; uint8_t pubkey33[33];
|
||||
checktoshis = PAX_fiatdest(&seed,0,destaddr,pubkey33,coinaddr,pax->height,CURRENCIES[baseids[i-1]],pax->fiatoshis);
|
||||
//checktoshis = komodo_paxprice(&seed,pax->height,CURRENCIES[baseids[i-1]],(char *)"KMD",(uint64_t)pax->komodoshis);
|
||||
if ( komodo_paxcmp(CURRENCIES[baseids[i-1]],pax->height,pax->komodoshis,checktoshis,seed) < 0 )
|
||||
{
|
||||
printf("paxcmp FAIL when check deposit validates %s.%d [%d] %.8f -> %.8f (%.8f %.8f %.8f)\n",CURRENCIES[baseids[i-1]],height,i,dstr(srcvalues[i-1]),dstr(values[i-1]),dstr(pax->komodoshis),dstr(pax->fiatoshis),dstr(block.vtx[0].vout[i].nValue));
|
||||
return(-1);
|
||||
} //else printf("check deposit validates %s.%d [%d] %.8f -> %.8f (%.8f %.8f %.8f)\n",CURRENCIES[baseids[i-1]],height,i,dstr(srcvalues[i-1]),dstr(values[i-1]),dstr(pax->komodoshis),dstr(pax->fiatoshis),dstr(block.vtx[0].vout[i].nValue));
|
||||
}
|
||||
}
|
||||
else if ( strcmp(ASSETCHAINS_SYMBOL,CURRENCIES[baseids[i-1]]) == 0 )
|
||||
{
|
||||
@@ -966,12 +966,13 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
||||
for (j=0; j<32; j++)
|
||||
printf("%02x",((uint8_t *)&hash)[j]);
|
||||
printf(" kht.%d ht.%d %.8f %.8f blockhash couldnt find vout.[%d] ht.%d %s for [%s]\n",kmdheights[i-1],otherheights[i-1],dstr(values[i-1]),dstr(srcvalues[i]),i,height,ASSETCHAINS_SYMBOL,CURRENCIES[baseids[i-1]]);
|
||||
return(-1);
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 || height >= activation )
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||
{
|
||||
if ( height > 0 && (height < chainActive.Tip()->nHeight || (height >= chainActive.Tip()->nHeight && komodo_isrealtime(&ht) != 0)) && matched != num )
|
||||
/*if ( height > 0 && (height < chainActive.Tip()->nHeight || (height >= chainActive.Tip()->nHeight && komodo_isrealtime(&ht) != 0)) && matched != num )
|
||||
{
|
||||
printf("WOULD REJECT %s: ht.%d (%c) matched.%d vs num.%d tip.%d isRT.%d\n",symbol,height,opcode,matched,num,(int32_t)chainActive.Tip()->nHeight,komodo_isrealtime(&ht));
|
||||
// can easily happen depending on order of loading
|
||||
@@ -980,7 +981,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
||||
printf("REJECT: ht.%d (%c) matched.%d vs num.%d\n",height,opcode,matched,num);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
}*/ // disabled 'X' path
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -993,37 +994,11 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
||||
}
|
||||
else
|
||||
{
|
||||
/*int64_t val,prevtotal = 0; int32_t overflow = 0;
|
||||
total = 0;
|
||||
for (i=1; i<n; i++)
|
||||
{
|
||||
if ( (val= block.vtx[0].vout[i].nValue) < 0 || val >= MAX_MONEY )
|
||||
{
|
||||
overflow = 1;
|
||||
break;
|
||||
}
|
||||
total += val;
|
||||
if ( total < prevtotal || (val != 0 && total == prevtotal) )
|
||||
{
|
||||
overflow = 1;
|
||||
break;
|
||||
}
|
||||
prevtotal = total;
|
||||
}
|
||||
if ( overflow != 0 || total > COIN/10 )
|
||||
{
|
||||
for (i=0; i<opretlen&&i<100; i++)
|
||||
printf("%02x",script[i]);
|
||||
printf(" script.[%d] ",opretlen);
|
||||
for (i=0; i<n; i++)
|
||||
printf("%.8f ",dstr(block.vtx[0].vout[i].nValue));
|
||||
printf("no opreturn entries to check ht.%d %s\n",height,ASSETCHAINS_SYMBOL);
|
||||
return(-1);
|
||||
} else return(0);*/
|
||||
for (i=0; i<n; i++)
|
||||
printf("%.8f ",dstr(block.vtx[0].vout[i].nValue));
|
||||
printf("no opreturn entries to check ht.%d %s\n",height,ASSETCHAINS_SYMBOL);
|
||||
return(-1);
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 || height >= activation )
|
||||
return(-1);
|
||||
}
|
||||
//printf("opretlen.%d num.%d\n",opretlen,num);
|
||||
}
|
||||
@@ -1033,7 +1008,6 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
||||
printf("%02x",script[i]);
|
||||
printf(" height.%d checkdeposit n.%d [%02x] [%c] %d len.%d ",height,n,script[0],script[offset],script[offset],opretlen);
|
||||
printf("not proper vout with opreturn format %s ht.%d\n",ASSETCHAINS_SYMBOL,height);
|
||||
exit(-1);
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
@@ -1128,7 +1102,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
||||
{
|
||||
basesp->issued += pax2->fiatoshis;
|
||||
pax2->didstats = 1;
|
||||
if ( 1 && strcmp(base,"USD") == 0 )
|
||||
if ( 0 && strcmp(base,"USD") == 0 )
|
||||
printf("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d [%d]\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->komodoshis),pax2->otherheight,height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,8 @@ uint64_t komodo_moneysupply(int32_t height)
|
||||
|
||||
uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime)
|
||||
{
|
||||
int32_t minutes,exception; uint64_t numerator,denominator,interest = 0;
|
||||
int32_t minutes,exception; uint64_t numerator,denominator,interest = 0; uint32_t activation;
|
||||
activation = 1491350400; // 1491350400 5th April
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
return(0);
|
||||
if ( komodo_moneysupply(txheight) < MAX_MONEY && nLockTime >= LOCKTIME_THRESHOLD && tiptime != 0 && nLockTime < tiptime && nValue >= 10*COIN )
|
||||
@@ -118,12 +119,28 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 250000 algo
|
||||
numerator = (nValue * KOMODO_INTEREST);
|
||||
if ( txheight < 250000 || numerator * minutes < 365 * 24 * 60 )
|
||||
interest = (numerator / denominator) / COIN;
|
||||
else interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60)) / COIN;
|
||||
*/
|
||||
numerator = (nValue * KOMODO_INTEREST);
|
||||
if ( txheight < 250000 || numerator * minutes < 365 * 24 * 60 )
|
||||
interest = (numerator / denominator) / COIN;
|
||||
else interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60)) / COIN;
|
||||
if ( txheight < 250000 || tiptime < activation )
|
||||
{
|
||||
if ( txheight < 250000 || numerator * minutes < 365 * 24 * 60 )
|
||||
interest = (numerator / denominator) / COIN;
|
||||
else interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60)) / COIN;
|
||||
}
|
||||
else
|
||||
{
|
||||
numerator = (nValue / 20); // assumes 5%!
|
||||
interest = ((numerator * minutes) / ((uint64_t)365 * 24 * 60));
|
||||
//fprintf(stderr,"interest %llu %.8f <- numerator.%llu minutes.%d\n",(long long)interest,(double)interest/COIN,(long long)numerator,(int32_t)minutes);
|
||||
}
|
||||
}
|
||||
//fprintf(stderr,"komodo_interest %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu)\n",(long long)nValue,(double)nValue/COIN,nLockTime,tiptime,minutes,(long long)interest,(double)interest/COIN,(long long)numerator,(long long)denominator);
|
||||
if ( 0 && numerator == (nValue * KOMODO_INTEREST) )
|
||||
fprintf(stderr,"komodo_interest.%d %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu) prod.%llu\n",txheight,(long long)nValue,(double)nValue/COIN,nLockTime,tiptime,minutes,(long long)interest,(double)interest/COIN,(long long)numerator,(long long)denominator,(long long)(numerator * minutes));
|
||||
}
|
||||
}
|
||||
return(interest);
|
||||
|
||||
@@ -1355,7 +1355,7 @@ void komodo_configfile(char *symbol,uint16_t port)
|
||||
komodo_userpass(username,password,fp);
|
||||
sprintf(KMDUSERPASS,"%s:%s",username,password);
|
||||
fclose(fp);
|
||||
//printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS);
|
||||
//printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS);
|
||||
} else printf("couldnt open.(%s)\n",fname);
|
||||
}
|
||||
|
||||
|
||||
@@ -1113,7 +1113,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
||||
auto verifier = libzcash::ProofVerifier::Strict();
|
||||
if ( komodo_validate_interest(tx,chainActive.Tip()->nHeight+1,chainActive.Tip()->GetMedianTimePast() + 777,0) < 0 )
|
||||
{
|
||||
fprintf(stderr,"AcceptToMemoryPool komodo_validate_interest failure\n");
|
||||
//fprintf(stderr,"AcceptToMemoryPool komodo_validate_interest failure\n");
|
||||
return error("AcceptToMemoryPool: komodo_validate_interest failed");
|
||||
}
|
||||
if (!CheckTransaction(tx, state, verifier))
|
||||
|
||||
@@ -650,14 +650,14 @@ void static BitcoinMiner(CWallet *pwallet)
|
||||
CBlock *pblock = &pblocktemplate->block;
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
{
|
||||
if ( pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT )
|
||||
if ( pblock->vtx.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT )
|
||||
{
|
||||
static uint32_t counter;
|
||||
if ( counter++ < 10 )
|
||||
fprintf(stderr,"skip generating %s on-demand block, no tx avail\n",ASSETCHAINS_SYMBOL);
|
||||
sleep(10);
|
||||
continue;
|
||||
} else fprintf(stderr,"vouts.%d mining.%d vs %d\n",(int32_t)pblock->vtx[0].vout.size(),Mining_height,ASSETCHAINS_MINHEIGHT);
|
||||
} else fprintf(stderr,"%s vouts.%d mining.%d vs %d\n",ASSETCHAINS_SYMBOL,(int32_t)pblock->vtx[0].vout.size(),Mining_height,ASSETCHAINS_MINHEIGHT);
|
||||
}
|
||||
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
|
||||
LogPrintf("Running KomodoMiner.%s with %u transactions in block (%u bytes)\n",solver.c_str(),pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION));
|
||||
@@ -703,11 +703,11 @@ void static BitcoinMiner(CWallet *pwallet)
|
||||
if ( mids[j] == -1 )
|
||||
gpucount++;
|
||||
}
|
||||
if ( gpucount > j/3 )
|
||||
if ( gpucount > j/2 )
|
||||
{
|
||||
double delta;
|
||||
i = ((Mining_height + notaryid) % 64);
|
||||
delta = sqrt((double)gpucount - j/3);
|
||||
delta = sqrt((double)gpucount - j/2) / 2.;
|
||||
roundrobin_delay += ((delta * i) / 64) - delta;
|
||||
//fprintf(stderr,"delta.%f %f %f\n",delta,(double)(gpucount - j/3) / 2,(delta * i) / 64);
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in
|
||||
fprintf(stderr,"pow error height.%d loading.%d notaryid.%d\n",height,KOMODO_LOADINGBLOCKS,notaryid);
|
||||
return error("CheckProofOfWork(): hash doesn't match nBits");
|
||||
} else fprintf(stderr,"skip return error height.%d loading.%d\n",height,KOMODO_LOADINGBLOCKS);
|
||||
} else fprintf(stderr,"skip height.%d loading.%d\n",height,KOMODO_LOADINGBLOCKS);
|
||||
} //else fprintf(stderr,"skip height.%d loading.%d\n",height,KOMODO_LOADINGBLOCKS);
|
||||
}
|
||||
if ( 0 && height > 248000 )
|
||||
{
|
||||
|
||||
@@ -46,11 +46,13 @@ int32_t komodo_longestchain();
|
||||
int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp);
|
||||
int32_t komodo_whoami(char *pubkeystr,int32_t height);
|
||||
extern int32_t KOMODO_LASTMINED;
|
||||
extern char ASSETCHAINS_SYMBOL[];
|
||||
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp);
|
||||
#define KOMODO_VERSION "0.1.0"
|
||||
|
||||
Value getinfo(const Array& params, bool fHelp)
|
||||
{
|
||||
uint256 notarized_hash,notarized_desttxid;
|
||||
int32_t notarized_height,longestchain;
|
||||
uint256 notarized_hash,notarized_desttxid; int32_t notarized_height,longestchain,kmdnotarized_height,txid_height;
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getinfo\n"
|
||||
@@ -92,14 +94,23 @@ Value getinfo(const Array& params, bool fHelp)
|
||||
Object obj;
|
||||
obj.push_back(Pair("version", CLIENT_VERSION));
|
||||
obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
|
||||
obj.push_back(Pair("KMDversion", KOMODO_VERSION));
|
||||
obj.push_back(Pair("notarized", notarized_height));
|
||||
obj.push_back(Pair("notarizedhash", notarized_hash.ToString()));
|
||||
obj.push_back(Pair("notarizedtxid", notarized_desttxid.ToString()));
|
||||
txid_height = notarizedtxid_height(ASSETCHAINS_SYMBOL[0] != 0 ? (char *)"KMD" : (char *)"BTC",(char *)notarized_desttxid.ToString().c_str(),&kmdnotarized_height);
|
||||
if ( txid_height > 0 )
|
||||
obj.push_back(Pair("notarizedtxid_height", txid_height));
|
||||
else obj.push_back(Pair("notarizedtxid_height", "mempool"));
|
||||
if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
obj.push_back(Pair("KMDnotarized_height", kmdnotarized_height));
|
||||
obj.push_back(Pair("notarized_confirms", txid_height < kmdnotarized_height ? (kmdnotarized_height - txid_height + 1) : 0));
|
||||
#ifdef ENABLE_WALLET
|
||||
if (pwalletMain) {
|
||||
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
||||
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance())));
|
||||
obj.push_back(Pair("interest", ValueFromAmount(komodo_interestsum())));
|
||||
if ( ASSETCHAINS_SYMBOL[0] == 0 )
|
||||
obj.push_back(Pair("interest", ValueFromAmount(komodo_interestsum())));
|
||||
}
|
||||
#endif
|
||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||
@@ -126,11 +137,13 @@ Value getinfo(const Array& params, bool fHelp)
|
||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||
{
|
||||
char pubkeystr[65]; int32_t notaryid;
|
||||
notaryid = komodo_whoami(pubkeystr,(int32_t)chainActive.Tip()->nHeight);
|
||||
obj.push_back(Pair("notaryid", notaryid));
|
||||
obj.push_back(Pair("pubkey", pubkeystr));
|
||||
if ( KOMODO_LASTMINED != 0 )
|
||||
obj.push_back(Pair("lastmined", KOMODO_LASTMINED));
|
||||
if ( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.Tip()->nHeight)) >= 0 )
|
||||
{
|
||||
obj.push_back(Pair("notaryid", notaryid));
|
||||
obj.push_back(Pair("pubkey", pubkeystr));
|
||||
if ( KOMODO_LASTMINED != 0 )
|
||||
obj.push_back(Pair("lastmined", KOMODO_LASTMINED));
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -2384,7 +2384,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
|
||||
//fprintf(stderr,"count.%d %.8f\n",count,(double)pcoin->vout[i].interest/COIN);
|
||||
interests[count++] = pcoin->vout[i].interest;
|
||||
}
|
||||
if ( nTotalLower > 2*nTargetValue + CENT )
|
||||
if ( count >= sizeof(interests)/sizeof(*interests) && nTotalLower > 2*nTargetValue + CENT )
|
||||
{
|
||||
//fprintf(stderr,"why bother with all the utxo if we have double what is needed?\n");
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user