Browse Source

test

pull/4/head
jl777 8 years ago
parent
commit
a4c672852f
  1. 5
      src/komodo.h
  2. 27
      src/komodo_gateway.h
  3. 2
      src/komodo_structs.h

5
src/komodo.h

@ -373,7 +373,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
sp->NOTARIZED_HASH = kmdtxid;
sp->NOTARIZED_DESTTXID = desttxid;
komodo_stateupdate(height,0,0,0,zero,0,0,0,0,0,0,0,0,0,0);
// extract X opreturns here
if ( opretlen > len && scriptbuf[len] == 'A' )
komodo_stateupdate(height,0,0,0,txhash,0,0,0,0,0,0,value,&scriptbuf[len],opretlen-len,j);
} else printf("notarized.%d reject ht.%d NOTARIZED.%d %s.%s DESTTXID.%s (%s)\n",notarized,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,kmdtxid.ToString().c_str(),desttxid.ToString().c_str(),(char *)&scriptbuf[len]);
}
else if ( i == 0 && j == 1 && opretlen == 149 )
@ -481,7 +482,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
}
}
printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
if ( specialtx != 0 && (((signedmask & 1) != 0 && numvalid >= KOMODO_MINRATIFY) || bitweight(signedmask) > (numnotaries>>1)) )
if ( (((signedmask & 1) != 0 && numvalid >= KOMODO_MINRATIFY) || bitweight(signedmask) > (numnotaries>>1)) )
{
printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
notarized = 1;

27
src/komodo_gateway.h

@ -155,6 +155,8 @@ uint64_t komodo_paxtotal()
return(total);
}
// need a function to return pending withdraws for notarizing opreturn
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[10000],data[10000]; int32_t i,baseid,ht,len=0,opretlen=0,numvouts=1; struct komodo_state *sp; uint64_t mask;
@ -372,19 +374,26 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3
else
{
printf(" %.8f -> %s withdraw already there\n",dstr(value),coinaddr);
strcpy(pax->coinaddr,coinaddr);
pax->komodoshis = komodoshis;
strcpy(pax->symbol,"KMD");
pax->fiatoshis = value;
memcpy(pax->rmd160,rmd160,20);
pax->height = kmdheight;
pax->otherheight = height;
komodo_gateway_deposit(coinaddr,komodoshis,"KMD",value,rmd160,txid,vout,kmdheight,height);
}
}
}
else if ( tokomodo != 0 && opretbuf[0] == 'A' )
{
if ( (n= komodo_issued_opreturn(base,txids,vouts,values,kmdheights,otherheights,baseids,opretbuf,opretlen,0)) > 0 )
{
for (i=0; i<n; i++)
{
if ( (pax= komodo_paxfind(&space,txids[i],vouts[i])) == 0 )
{
komodo_gateway_deposit(0,0,0,0,0,txids[i],vouts[i],kmdheights[i],otherheights[i]);
} else pax->approved = kmdheights[i];
}
}
}
else if ( strncmp((char *)"KMD",(char *)&opretbuf[opretlen-4],3) != 0 || opretlen == 38 )
else if ( tokomodo == 0 && opretbuf[0] == 'I' )
{
if ( tokomodo == 0 && opretbuf[0] == 'I' ) // assetchain coinbase
if ( strncmp((char *)"KMD",(char *)&opretbuf[opretlen-4],3) != 0 )
{
if ( (n= komodo_issued_opreturn(base,txids,vouts,values,kmdheights,otherheights,baseids,opretbuf,opretlen,0)) > 0 )
{

2
src/komodo_structs.h

@ -57,7 +57,7 @@ struct pax_transaction
UT_hash_handle hh;
uint256 txid;
uint64_t komodoshis,fiatoshis;
int32_t marked,height,otherheight;
int32_t marked,height,otherheight,approved;
uint16_t vout;
char symbol[16],coinaddr[64]; uint8_t rmd160[20],shortflag;
};

Loading…
Cancel
Save