Browse Source

Test

pull/4/head
jl777 7 years ago
parent
commit
081ab21c65
  1. 4
      src/komodo.h
  2. 15
      src/komodo_gateway.h

4
src/komodo.h

@ -546,7 +546,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
}
for (j=0; j<numvouts; j++)
{
if ( i == 0 && j == 0 )
/*if ( i == 0 && j == 0 )
{
uint8_t *script = (uint8_t *)block.vtx[0].vout[numvouts-1].scriptPubKey.data();
if ( numvouts <= 2 || script[0] != 0x6a )
@ -559,7 +559,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
break;
}
}
}
}*/
len = block.vtx[i].vout[j].scriptPubKey.size();
if ( len >= sizeof(uint32_t) && len <= sizeof(scriptbuf) )
{

15
src/komodo_gateway.h

@ -610,8 +610,8 @@ char *banned_txids[] =
void komodo_bannedset(uint256 *array,int32_t max)
{
int32_t i;
for (i=0; i<sizeof(banned)/sizeof(*banned); i++)
array[i] = uint256S(banned[i]);
for (i=0; i<sizeof(banned_txids)/sizeof(*banned_txids); i++)
array[i] = uint256S(banned_txids[i]);
if ( i != max )
printf("banned txid array error i.%d != max.%d\n",i,max);
else printf("set %d banned txids\n",max);
@ -620,7 +620,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,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 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 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));
@ -635,10 +635,13 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
n = block.vtx[i].vin.size();
for (j=0; j<n; j++)
{
if ( block.vtx[i].vin[j].prevout.hash == array[k] && block.vtx[i].vin[j].prevout.n == 1 )
for (k=0; k<sizeof(array)/sizeof(*array); k++)
{
printf("banned tx.%d being used at ht.%d txi.%d vini.%d\n",k,height,i,j);
return(-1);
if ( block.vtx[i].vin[j].prevout.hash == array[k] && block.vtx[i].vin[j].prevout.n == 1 )
{
printf("banned tx.%d being used at ht.%d txi.%d vini.%d\n",k,height,i,j);
return(-1);
}
}
}
}

Loading…
Cancel
Save