|
|
|
|
@@ -28,7 +28,6 @@ int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,
|
|
|
|
|
*withdrawn = sp->withdrawn;
|
|
|
|
|
*approved = sp->approved;
|
|
|
|
|
*redeemed = sp->redeemed;
|
|
|
|
|
//netliability = (sp->deposited - sp->withdrawn) - sp->shorted;
|
|
|
|
|
maxval = sp->approved;
|
|
|
|
|
if ( sp->withdrawn > maxval )
|
|
|
|
|
maxval = sp->withdrawn;
|
|
|
|
|
@@ -36,7 +35,7 @@ int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,
|
|
|
|
|
maxallowed = komodo_maxallowed(baseid);
|
|
|
|
|
if ( netliability < maxallowed )
|
|
|
|
|
*available = (maxallowed - netliability);
|
|
|
|
|
//printf("%p %s %.8f %.8f %.8f %.8f %.8f\n",sp,base,dstr(*deposited),dstr(*issued),dstr(*withdrawn),dstr(*approved),dstr(*redeemed));
|
|
|
|
|
printf("%llu - %llu %s %.8f %.8f %.8f %.8f %.8f\n",(long long)maxallowed,(long long)netliability,base,dstr(*deposited),dstr(*issued),dstr(*withdrawn),dstr(*approved),dstr(*redeemed));
|
|
|
|
|
return(0);
|
|
|
|
|
} else printf("pax_fiatstatus cant get basesp.%s\n",base);
|
|
|
|
|
} // else printf("pax_fiatstatus illegal base.%s\n",base);
|
|
|
|
|
@@ -60,22 +59,12 @@ struct pax_transaction *komodo_paxfind(uint256 txid,uint16_t vout,uint8_t type)
|
|
|
|
|
return(pax);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct pax_transaction *komodo_paxfinds(int32_t strictflag,uint256 txid,uint16_t vout)
|
|
|
|
|
struct pax_transaction *komodo_paxfinds(uint256 txid,uint16_t vout)
|
|
|
|
|
{
|
|
|
|
|
struct pax_transaction *pax; int32_t i; uint8_t types[] = { 'I', 'D', 'X', 'A', 'W' };
|
|
|
|
|
if ( strictflag != 0 )
|
|
|
|
|
{
|
|
|
|
|
if ( (pax= komodo_paxfind(txid,vout,'D')) != 0 )
|
|
|
|
|
for (i=0; i<sizeof(types)/sizeof(*types); i++)
|
|
|
|
|
if ( (pax= komodo_paxfind(txid,vout,types[i])) != 0 )
|
|
|
|
|
return(pax);
|
|
|
|
|
//if ( (pax= komodo_paxfind(txid,vout,'X')) != 0 )
|
|
|
|
|
// return(pax);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (i=0; i<sizeof(types)/sizeof(*types); i++)
|
|
|
|
|
if ( (pax= komodo_paxfind(txid,vout,types[i])) != 0 )
|
|
|
|
|
return(pax);
|
|
|
|
|
}
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -258,7 +247,7 @@ int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t
|
|
|
|
|
vouts[n] = opretbuf[len++];
|
|
|
|
|
vouts[n] = (opretbuf[len++] << 8) | vouts[n];
|
|
|
|
|
baseids[n] = komodo_baseid(base);
|
|
|
|
|
if ( (pax= komodo_paxfinds(0,txids[n],vouts[n])) != 0 )
|
|
|
|
|
if ( (pax= komodo_paxfinds(txids[n],vouts[n])) != 0 )
|
|
|
|
|
{
|
|
|
|
|
values[n] = (strcmp("KMD",base) == 0) ? pax->komodoshis : pax->fiatoshis;
|
|
|
|
|
srcvalues[n] = (strcmp("KMD",base) == 0) ? pax->fiatoshis : pax->komodoshis;
|
|
|
|
|
@@ -279,7 +268,7 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che
|
|
|
|
|
if ( seed == 0 && checkvalue != 0 )
|
|
|
|
|
{
|
|
|
|
|
ratio = ((value << 6) / checkvalue);
|
|
|
|
|
if ( ratio >= 63 && ratio <= 65 )
|
|
|
|
|
if ( ratio >= 62 && ratio <= 66 )
|
|
|
|
|
return(0);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@@ -357,11 +346,8 @@ uint64_t komodo_paxtotal()
|
|
|
|
|
HASH_ITER(hh,PAX,pax,tmp)
|
|
|
|
|
{
|
|
|
|
|
pax->ready = 0;
|
|
|
|
|
char str[65],coinaddr[64]; bits256 tmp;
|
|
|
|
|
bitcoin_address(coinaddr,60,pax->rmd160,20);
|
|
|
|
|
memcpy(&tmp,&pax->txid,sizeof(tmp));
|
|
|
|
|
if ( 0 && pax->fiatoshis > 9000*SATOSHIDEN )//pax->type == 'A' )
|
|
|
|
|
printf("(%s).%c pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d %s\n",coinaddr,pax->type,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0,bits256_str(str,tmp));
|
|
|
|
|
if ( 0 && pax->type == 'A' )
|
|
|
|
|
printf("%p pax.%s <- %s marked.%d %.8f -> %.8f validated.%d approved.%d\n",pax,pax->symbol,pax->source,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->validated != 0,pax->approved != 0);
|
|
|
|
|
if ( pax->marked != 0 )
|
|
|
|
|
continue;
|
|
|
|
|
if ( strcmp(symbol,pax->symbol) == 0 || pax->type == 'A' )
|
|
|
|
|
@@ -442,7 +428,7 @@ int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic
|
|
|
|
|
if ( pax2->approved != 0 )
|
|
|
|
|
pax->approved = pax2->approved;
|
|
|
|
|
}
|
|
|
|
|
else if ( (pax2= komodo_paxfind(pax->txid,pax->vout,'x')) != 0 )
|
|
|
|
|
else if ( (pax2= komodo_paxfind(pax->txid,pax->vout,'X')) != 0 )
|
|
|
|
|
pax->approved = pax->height;
|
|
|
|
|
//printf("pending_withdraw: pax %s marked.%u approved.%u validated.%llu\n",pax->symbol,pax->marked,pax->approved,(long long)pax->validated);
|
|
|
|
|
if ( pax->marked == 0 && pax->approved == 0 && pax->validated != 0 ) //strcmp((char *)"KMD",pax->symbol) == 0 &&
|
|
|
|
|
@@ -477,7 +463,7 @@ int32_t komodo_pending_withdraws(char *opretstr) // todo: enforce deterministic
|
|
|
|
|
int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t tokomodo)
|
|
|
|
|
{
|
|
|
|
|
struct pax_transaction *pax,*tmp; char symbol[16],dest[16]; uint8_t *script,opcode,opret[16384],data[16384]; int32_t i,baseid,ht,len=0,opretlen=0,numvouts=1; struct komodo_state *sp; uint64_t available,deposited,issued,withdrawn,approved,redeemed,mask;
|
|
|
|
|
if ( KOMODO_PAX == 0 || KOMODO_PASSPORT_INITDONE == 0 || ASSETCHAINS_SYMBOL[0] == 0 )
|
|
|
|
|
if ( KOMODO_PAX == 0 || KOMODO_PASSPORT_INITDONE == 0 )
|
|
|
|
|
return(0);
|
|
|
|
|
struct komodo_state *kmdsp = komodo_stateptrget((char *)"KMD");
|
|
|
|
|
sp = komodo_stateptr(symbol,dest);
|
|
|
|
|
@@ -503,7 +489,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
opcode = 'X';
|
|
|
|
|
if ( komodo_paxtotal() == 0 )
|
|
|
|
|
if ( 1 || komodo_paxtotal() == 0 )
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
|
|
|
|
HASH_ITER(hh,PAX,pax,tmp)
|
|
|
|
|
@@ -514,7 +500,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
|
|
|
|
|
#ifdef KOMODO_ASSETCHAINS_WAITNOTARIZE
|
|
|
|
|
if ( pax->height > 236000 )
|
|
|
|
|
{
|
|
|
|
|
if ( pax->type == 'D' || (kmdsp != 0 && kmdsp->NOTARIZED_HEIGHT >= pax->height) )
|
|
|
|
|
if ( kmdsp != 0 && kmdsp->NOTARIZED_HEIGHT >= pax->height )
|
|
|
|
|
pax->validated = pax->komodoshis;
|
|
|
|
|
else if ( kmdsp->CURRENT_HEIGHT > pax->height+30 )
|
|
|
|
|
pax->validated = pax->ready = 0;
|
|
|
|
|
@@ -533,7 +519,6 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
|
|
|
|
|
{
|
|
|
|
|
if ( pax->height > 214700 || strcmp(ASSETCHAINS_SYMBOL,symbol) == 0 )
|
|
|
|
|
printf("miner.[%s]: skip %s %.8f when avail %.8f deposited %.8f, issued %.8f withdrawn %.8f approved %.8f redeemed %.8f\n",ASSETCHAINS_SYMBOL,symbol,dstr(pax->fiatoshis),dstr(available),dstr(deposited),dstr(issued),dstr(withdrawn),dstr(approved),dstr(redeemed));
|
|
|
|
|
pax->marked = pax->fiatoshis;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
/*printf("pax.%s marked.%d %.8f -> %.8f ready.%d validated.%d\n",pax->symbol,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis),pax->ready!=0,pax->validated!=0);
|
|
|
|
|
@@ -546,6 +531,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
|
|
|
|
|
{
|
|
|
|
|
if ( strcmp(pax->symbol,ASSETCHAINS_SYMBOL) == 0 )
|
|
|
|
|
printf("pax->symbol.%s != %s or null pax->validated %.8f ready.%d ht.(%d %d)\n",pax->symbol,symbol,dstr(pax->validated),pax->ready,kmdsp->CURRENT_HEIGHT,pax->height);
|
|
|
|
|
pax->marked = pax->fiatoshis;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if ( pax->ready == 0 )
|
|
|
|
|
@@ -599,12 +585,9 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
|
|
|
|
|
for (i=0; symbol[i]!=0; i++)
|
|
|
|
|
data[len++] = symbol[i];
|
|
|
|
|
data[len++] = 0;
|
|
|
|
|
if ( 0 && pax != 0 )
|
|
|
|
|
{
|
|
|
|
|
for (i=0; i<32; i++)
|
|
|
|
|
printf("%02x",((uint8_t *)&pax->txid)[32-1-i]);
|
|
|
|
|
printf(" <- data[%d]\n",len);
|
|
|
|
|
}
|
|
|
|
|
for (i=0; i<len; i++)
|
|
|
|
|
printf("%02x",data[i]);
|
|
|
|
|
printf(" <- data[%d]\n",len);
|
|
|
|
|
opretlen = komodo_opreturnscript(opret,opcode,data,len);
|
|
|
|
|
txNew->vout.resize(numvouts+1);
|
|
|
|
|
txNew->vout[numvouts].nValue = 0;
|
|
|
|
|
@@ -651,7 +634,7 @@ void komodo_bannedset(uint256 *array,int32_t max)
|
|
|
|
|
int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above block is valid pax pricing
|
|
|
|
|
{
|
|
|
|
|
static uint256 array[15];
|
|
|
|
|
int32_t i,j,k,n,ht,retval,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 maxval,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,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;
|
|
|
|
|
if ( *(int32_t *)&array[0] == 0 )
|
|
|
|
|
komodo_bannedset(array,(int32_t)(sizeof(array)/sizeof(*array)));
|
|
|
|
|
memset(baseids,0xff,sizeof(baseids));
|
|
|
|
|
@@ -680,10 +663,24 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
|
|
|
|
script = (uint8_t *)block.vtx[0].vout[n-1].scriptPubKey.data();
|
|
|
|
|
if ( n <= 2 || script[0] != 0x6a )
|
|
|
|
|
{
|
|
|
|
|
int64_t val,prevtotal = 0; int32_t overflow = 0;
|
|
|
|
|
total = 0;
|
|
|
|
|
for (i=1; i<n; i++)
|
|
|
|
|
total += block.vtx[0].vout[i].nValue;
|
|
|
|
|
if ( total > COIN/10 )
|
|
|
|
|
{
|
|
|
|
|
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 )
|
|
|
|
|
{
|
|
|
|
|
//fprintf(stderr,">>>>>>>> <<<<<<<<<< ht.%d illegal nonz output %.8f n.%d\n",height,dstr(block.vtx[0].vout[1].nValue),n);
|
|
|
|
|
if ( height >= 235300 )
|
|
|
|
|
@@ -701,9 +698,9 @@ 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 vs %d\n",height,n,script[0],script[offset],script[offset],'X');
|
|
|
|
|
opcode = 'X';
|
|
|
|
|
strcpy(symbol,(char *)"KMD");
|
|
|
|
|
if ( height >= 235300 )
|
|
|
|
|
return(-1); // no redeems for now
|
|
|
|
|
return(-1);
|
|
|
|
|
strcpy(symbol,(char *)"KMD");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@@ -731,23 +728,15 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
|
|
|
|
matched++;
|
|
|
|
|
continue;*/
|
|
|
|
|
}
|
|
|
|
|
if ( (pax= komodo_paxfinds(0,txids[i-1],vouts[i-1])) != 0 ) // finds... make sure right one
|
|
|
|
|
if ( (pax= komodo_paxfinds(txids[i-1],vouts[i-1])) != 0 ) // finds... make sure right one
|
|
|
|
|
{
|
|
|
|
|
pax->type = opcode;
|
|
|
|
|
if ( pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,symbol) < 0 )
|
|
|
|
|
{
|
|
|
|
|
matched++; // this node isnt running this assetchain, leaves validation to others
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
maxval = approved;
|
|
|
|
|
if ( redeemed > maxval )
|
|
|
|
|
maxval = redeemed;
|
|
|
|
|
if ( (opcode == 'I' && available < pax->fiatoshis) || (opcode == 'X' && pax->komodoshis > issued-maxval) )
|
|
|
|
|
if ( opcode == 'I' && (pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,symbol) != 0 || available < pax->fiatoshis) )
|
|
|
|
|
{
|
|
|
|
|
printf("checkdeposit.[%s]: skip %s %.8f when avail %.8f deposited %.8f, issued %.8f withdrawn %.8f approved %.8f redeemed %.8f\n",ASSETCHAINS_SYMBOL,symbol,dstr(pax->fiatoshis),dstr(available),dstr(deposited),dstr(issued),dstr(withdrawn),dstr(approved),dstr(redeemed));
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if ( (opcode == 'I' && pax->fiatoshis == block.vtx[0].vout[i].nValue) || (opcode == 'X' && pax->komodoshis == block.vtx[0].vout[i].nValue) )
|
|
|
|
|
if ( ((opcode == 'I' && (pax->fiatoshis == 0 || pax->fiatoshis == block.vtx[0].vout[i].nValue)) || (opcode == 'X' && (pax->komodoshis == 0 || pax->komodoshis == block.vtx[0].vout[i].nValue))) )
|
|
|
|
|
{
|
|
|
|
|
if ( pax->marked != 0 && height >= 80820 )
|
|
|
|
|
{
|
|
|
|
|
@@ -818,7 +807,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
|
|
|
|
|
|
|
|
|
const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int32_t opretlen,uint256 txid,uint16_t vout,char *source)
|
|
|
|
|
{
|
|
|
|
|
uint8_t rmd160[20],rmd160s[64*20],addrtype,shortflag,pubkey33[33]; int32_t didstats,i,j,n,kvheight,len,tokomodo,kmdheight,otherheights[64],kmdheights[64]; int8_t baseids[64]; char base[4],coinaddr[64],destaddr[64]; uint256 txids[64]; uint16_t vouts[64]; uint64_t convtoshis,seed; int64_t fee,fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax,*pax2; struct komodo_state *basesp; double diff;
|
|
|
|
|
uint8_t rmd160[20],rmd160s[64*20],addrtype,shortflag,pubkey33[33]; int32_t didstats,i,j,n,kvheight,len,tokomodo,kmdheight,otherheights[64],kmdheights[64]; int8_t baseids[64]; char base[4],coinaddr[64],destaddr[64]; uint256 txids[64]; uint16_t vouts[64]; uint64_t convtoshis,seed; int64_t fee,fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax,*pax2; struct komodo_state *basesp; double diff;
|
|
|
|
|
const char *typestr = "unknown";
|
|
|
|
|
if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) < 0 && opretbuf[0] != 'K' )
|
|
|
|
|
{
|
|
|
|
|
@@ -852,9 +841,9 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
|
|
|
|
if ( kmdheight > 195000 || kmdheight <= height )
|
|
|
|
|
{
|
|
|
|
|
didstats = 0;
|
|
|
|
|
if ( 1 && strcmp("EUR",ASSETCHAINS_SYMBOL) == 0 && kmdheight > 214700 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 )
|
|
|
|
|
if ( 0 && kmdheight > 214700 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 )
|
|
|
|
|
{
|
|
|
|
|
printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx paxcmp.%d\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed,komodo_paxcmp(base,kmdheight,value,checktoshis,0));
|
|
|
|
|
printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed);
|
|
|
|
|
for (i=0; i<32; i++)
|
|
|
|
|
printf("%02x",((uint8_t *)&txid)[i]);
|
|
|
|
|
printf(" <- txid.v%u ",vout);
|
|
|
|
|
@@ -906,18 +895,19 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
|
|
|
|
basesp->issued += pax2->fiatoshis;
|
|
|
|
|
pax2->didstats = 1;
|
|
|
|
|
if ( 0 && strcmp(base,ASSETCHAINS_SYMBOL) == 0 )
|
|
|
|
|
{
|
|
|
|
|
char str[65]; bits256 tmp;
|
|
|
|
|
memcpy(&tmp,&pax2->txid,sizeof(tmp));
|
|
|
|
|
printf("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d (%s)\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->komodoshis),pax2->otherheight,bits256_str(str,tmp));
|
|
|
|
|
}
|
|
|
|
|
printf("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->komodoshis),pax2->otherheight);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( kmdheight > 238000 && (kmdheight > 214700 || strcmp(base,ASSETCHAINS_SYMBOL) == 0) ) //seed != 0 &&
|
|
|
|
|
printf("pax %s deposit %.8f rejected kmdheight.%d %.8f KMD check %.8f seed.%llu\n",base,dstr(fiatoshis),kmdheight,dstr(value),dstr(checktoshis),(long long)seed);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if ( (pax= komodo_paxfind(txid,vout,'D')) != 0 )
|
|
|
|
|
pax->marked = checktoshis;
|
|
|
|
|
if ( kmdheight > 238000 && (kmdheight > 214700 || strcmp(base,ASSETCHAINS_SYMBOL) == 0) ) //seed != 0 &&
|
|
|
|
|
printf("pax %s deposit %.8f rejected kmdheight.%d %.8f KMD check %.8f seed.%llu\n",base,dstr(fiatoshis),kmdheight,dstr(value),dstr(checktoshis),(long long)seed);
|
|
|
|
|
}
|
|
|
|
|
} //else printf("paxdeposit height.%d vs kmdheight.%d\n",height,kmdheight);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -956,7 +946,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
|
|
|
|
pax->didstats = 1;
|
|
|
|
|
pax->height = pax2->height;
|
|
|
|
|
pax->otherheight = height;
|
|
|
|
|
if ( strcmp("USD",ASSETCHAINS_SYMBOL) == 0 && strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 )
|
|
|
|
|
if ( 0 && strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 )
|
|
|
|
|
printf("########### %p issuedb %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,CURRENCIES[baseids[i]],dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -970,7 +960,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
|
|
|
|
} //else printf("opreturn none issued?\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( opretbuf[0] == 'W' )//&& opretlen >= 38 )
|
|
|
|
|
else if ( height < 236000 && opretbuf[0] == 'W' )//&& opretlen >= 38 )
|
|
|
|
|
{
|
|
|
|
|
if ( komodo_baseid((char *)&opretbuf[opretlen-4]) >= 0 && strcmp(ASSETCHAINS_SYMBOL,(char *)&opretbuf[opretlen-4]) == 0 )
|
|
|
|
|
{
|
|
|
|
|
@@ -1015,7 +1005,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
|
|
|
|
} // else printf("withdraw %s paxcmp ht.%d %d error value %.8f -> %.8f vs %.8f\n",base,kmdheight,height,dstr(value),dstr(komodoshis),dstr(checktoshis));
|
|
|
|
|
// need to allocate pax
|
|
|
|
|
}
|
|
|
|
|
else if ( tokomodo != 0 && opretbuf[0] == 'A' )
|
|
|
|
|
else if ( height < 236000 && tokomodo != 0 && opretbuf[0] == 'A' )
|
|
|
|
|
{
|
|
|
|
|
tokomodo = 1;
|
|
|
|
|
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
|
|
|
|
|
@@ -1094,7 +1084,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
|
|
|
|
|
} //else printf("n.%d from opreturns\n",n);
|
|
|
|
|
//printf("extra.[%d] after %.8f\n",n,dstr(komodo_paxtotal()));
|
|
|
|
|
}
|
|
|
|
|
else if ( opretbuf[0] == 'x' )
|
|
|
|
|
else if ( height < 236000 && opretbuf[0] == 'X' )
|
|
|
|
|
{
|
|
|
|
|
tokomodo = 1;
|
|
|
|
|
if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,1)) > 0 )
|
|
|
|
|
|