test
This commit is contained in:
@@ -352,7 +352,7 @@ int32_t komodo_pending_withdraws(char *opretstr)
|
||||
|
||||
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 mask;
|
||||
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;
|
||||
sp = komodo_stateptr(symbol,dest);
|
||||
strcpy(symbol,base);
|
||||
PENDING_KOMODO_TX = 0;
|
||||
@@ -375,6 +375,11 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
|
||||
pax->validated = kmdsp->NOTARIZED_HEIGHT;
|
||||
#endif
|
||||
}
|
||||
if ( pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,symbol) != 0 || available < pax->fiatoshis )
|
||||
{
|
||||
printf("miner: skip %s %.8f when avail %.8f\n",symbol,dstr(pax->fiatoshis),dstr(available));
|
||||
continue;
|
||||
}
|
||||
if ( pax->marked != 0 || strcmp(pax->symbol,symbol) != 0 || pax->validated == 0 )
|
||||
continue;
|
||||
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
@@ -427,7 +432,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to
|
||||
|
||||
int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above block is valid pax pricing
|
||||
{
|
||||
int32_t i,j,n,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]; int64_t values[64],srcvalues[64]; struct pax_transaction *pax;
|
||||
int32_t i,j,n,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 available,deposited,issued,withdrawn,approved,redeemed; int64_t values[64],srcvalues[64]; struct pax_transaction *pax;
|
||||
memset(baseids,0xff,sizeof(baseids));
|
||||
memset(values,0,sizeof(values));
|
||||
memset(srcvalues,0,sizeof(srcvalues));
|
||||
@@ -461,35 +466,32 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
|
||||
if ( (pax= komodo_paxfinds(txids[i-1],vouts[i-1])) != 0 )
|
||||
{
|
||||
pax->type = opcode;
|
||||
if ( opcode == 'I' && pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,symbol) != 0 || available < pax->fiatoshis )
|
||||
{
|
||||
printf("checkdeposit: skip %s %.8f when avail %.8f\n",pax->symbol,dstr(pax->fiatoshis),dstr(available));
|
||||
continue;
|
||||
}
|
||||
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 )
|
||||
errs++;
|
||||
else matched++;
|
||||
//if ( opcode == 'X' )
|
||||
printf("%c errs.%d i.%d match %.8f vs %.8f pax.%p\n",opcode,errs,i,dstr(opcode == 'I' ? pax->fiatoshis : pax->komodoshis),dstr(block.vtx[0].vout[i].nValue),pax);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if ( opcode == 'X' )
|
||||
{
|
||||
for (j=0; j<32; j++)
|
||||
printf("%02x",((uint8_t *)&txids[i-1])[j]);
|
||||
printf(" cant paxfind %c txid\n",opcode);
|
||||
printf("%c errs.%d i.%d match %.8f vs %.8f pax.%p\n",opcode,errs,i,dstr(opcode == 'I' ? pax->fiatoshis : pax->komodoshis),dstr(block.vtx[0].vout[i].nValue),pax);
|
||||
}
|
||||
for (j=0; j<32; j++)
|
||||
printf("%02x",((uint8_t *)&txids[i-1])[j]);
|
||||
printf(" cant paxfind %c txid\n",opcode);
|
||||
printf("%c errs.%d i.%d match %.8f vs %.8f pax.%p\n",opcode,errs,i,dstr(opcode == 'I' ? pax->fiatoshis : pax->komodoshis),dstr(block.vtx[0].vout[i].nValue),pax);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//if ( opcode == 'X' )
|
||||
{
|
||||
hash = block.GetHash();
|
||||
for (j=0; j<32; j++)
|
||||
printf("%02x",((uint8_t *)&hash)[j]);
|
||||
printf(" ht.%d blockhash X couldnt find vout.[%d]\n",height,i);
|
||||
} //else if ( opcode == 'I' )
|
||||
// matched++;
|
||||
hash = block.GetHash();
|
||||
for (j=0; j<32; j++)
|
||||
printf("%02x",((uint8_t *)&hash)[j]);
|
||||
printf(" ht.%d blockhash X couldnt find vout.[%d]\n",height,i);
|
||||
}
|
||||
}
|
||||
if ( matched != num )
|
||||
|
||||
@@ -96,7 +96,7 @@ uint64_t peggy_smooth_coeffs[sizeof(Peggy_inds)/sizeof(*Peggy_inds)] = // numpri
|
||||
|
||||
uint64_t komodo_maxallowed(int32_t baseid)
|
||||
{
|
||||
uint64_t mult,val = (uint64_t)10000 * COIN;
|
||||
uint64_t mult,val = COIN; // * (uint64_t)10000;
|
||||
if ( baseid < 0 || baseid >= 32 )
|
||||
return(0);
|
||||
if ( baseid < 10 )
|
||||
|
||||
@@ -486,7 +486,7 @@ int32_t pax_fiatstatus(uint64_t *available,uint64_t *deposited,uint64_t *issued,
|
||||
|
||||
Value paxdeposit(const Array& params, bool fHelp)
|
||||
{
|
||||
uint64_t seed,komodoshis = 0; int32_t height; char destaddr[64]; uint8_t i,pubkey37[33];
|
||||
uint64_t available,deposited,issued,withdrawn,approved,redeemed,seed,komodoshis = 0; int32_t height; char destaddr[64]; uint8_t i,pubkey37[33];
|
||||
bool fSubtractFeeFromAmount = false;
|
||||
if ( komodo_is_issuer() != 0 )
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "paxdeposit only from KMD");
|
||||
@@ -502,7 +502,7 @@ Value paxdeposit(const Array& params, bool fHelp)
|
||||
std::string base = params[2].get_str();
|
||||
std::string dest;
|
||||
height = chainActive.Tip()->nHeight;
|
||||
if ( pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,CURRENCIES[baseid]) != 0 || available < fiatoshis )
|
||||
if ( pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,(char *)base.c_str()) != 0 || available < fiatoshis )
|
||||
throw runtime_error("paxdeposit no available inventory");
|
||||
komodoshis = PAX_fiatdest(&seed,0,destaddr,pubkey37,(char *)params[0].get_str().c_str(),height,(char *)base.c_str(),fiatoshis);
|
||||
dest.append(destaddr);
|
||||
|
||||
Reference in New Issue
Block a user