diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index bec970bbb..4de8805ba 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -95,15 +95,16 @@ void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t } } -int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t *values,int32_t *kmdheights,int32_t *otherheights,int8_t *baseids,uint8_t *opretbuf,int32_t opretlen,int32_t iskomodo) +int32_t komodo_issued_opreturn(char *base,uint256 *txids,uint16_t *vouts,int64_t *values,int32_t *kmdheights,int32_t *otherheights,int8_t *baseids,uint8_t *rmd160s,uint8_t *opretbuf,int32_t opretlen,int32_t iskomodo) { - int32_t i,n=0,j,len; + int32_t i,n=0,j,len,incr; uint8_t rmd160[20]; for (i=0; i<4; i++) base[i] = opretbuf[opretlen-4+i]; if ( ASSETCHAINS_SYMBOL[0] == 0 || strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0 ) { opretbuf++, opretlen--; - for (n=len=0; n>>>>>> iskomodo X: (%s) fiat %.8f kmdheight.%d other.%d\n",symbol,dstr(fiatoshis),height,otherheight); @@ -155,7 +158,20 @@ uint64_t komodo_paxtotal() return(total); } -// need a function to return pending withdraws for notarizing opreturn +int32_t komodo_withdraws_pending(char *opretbuf) +{ + struct pax_transaction *pax,*tmp; int32_t ht,len=0; uint64_t total = 0; + if ( komodo_isrealtime(&ht) == 0 || ASSETCHAINS_SYMBOL[0] != 0 ) + return(0); + HASH_ITER(hh,PAX,pax,tmp) + { + if ( pax->marked == 0 && strcmp((char *)"KMD",pax->symbol) == 0 && pax->approved == 0 ) + { + // add 'A' opreturn entry + } + } + return(len); +} int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t tokomodo) { @@ -232,9 +248,10 @@ 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; int64_t values[64]; struct pax_transaction *pax,space; + 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]; struct pax_transaction *pax,space; memset(baseids,0xff,sizeof(baseids)); memset(values,0,sizeof(values)); + memset(rmd160s,0,sizeof(rmd160s)); memset(kmdheights,0,sizeof(kmdheights)); memset(otherheights,0,sizeof(otherheights)); n = block.vtx[0].vout.size(); @@ -257,7 +274,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above } if ( script[offset] == opcode && opretlen < block.vtx[0].vout[n-1].scriptPubKey.size() ) { - if ( (num= komodo_issued_opreturn(base,txids,vouts,values,kmdheights,otherheights,baseids,&script[offset],opretlen,opcode == 'X')) > 0 ) + if ( (num= komodo_issued_opreturn(base,txids,vouts,values,kmdheights,otherheights,baseids,rmd160s,&script[offset],opretlen,opcode == 'X')) > 0 ) { for (i=1; i 0 ) + if ( (n= komodo_issued_opreturn(base,txids,vouts,values,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,0)) > 0 ) { for (i=0; iapproved = kmdheights[i]; } }