test
This commit is contained in:
@@ -545,7 +545,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
|
|||||||
for (j=0; j<numvouts; j++)
|
for (j=0; j<numvouts; j++)
|
||||||
{
|
{
|
||||||
len = block.vtx[i].vout[j].scriptPubKey.size();
|
len = block.vtx[i].vout[j].scriptPubKey.size();
|
||||||
if ( len <= sizeof(scriptbuf) )
|
if ( len >= sizeof(uint_32) && len <= sizeof(scriptbuf) )
|
||||||
{
|
{
|
||||||
#ifdef KOMODO_ZCASH
|
#ifdef KOMODO_ZCASH
|
||||||
memcpy(scriptbuf,block.vtx[i].vout[j].scriptPubKey.data(),len);
|
memcpy(scriptbuf,block.vtx[i].vout[j].scriptPubKey.data(),len);
|
||||||
@@ -576,7 +576,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
|
|||||||
for (j=1; j<numvouts-1; j++)
|
for (j=1; j<numvouts-1; j++)
|
||||||
{
|
{
|
||||||
len = block.vtx[i].vout[j].scriptPubKey.size();
|
len = block.vtx[i].vout[j].scriptPubKey.size();
|
||||||
if ( len <= sizeof(scriptbuf) )
|
if ( len >= sizeof(uint32_t) && len <= sizeof(scriptbuf) )
|
||||||
{
|
{
|
||||||
#ifdef KOMODO_ZCASH
|
#ifdef KOMODO_ZCASH
|
||||||
memcpy(scriptbuf,block.vtx[i].vout[j].scriptPubKey.data(),len);
|
memcpy(scriptbuf,block.vtx[i].vout[j].scriptPubKey.data(),len);
|
||||||
|
|||||||
@@ -511,18 +511,21 @@ void komodo_disconnect(CBlockIndex *pindex,CBlock& block)
|
|||||||
int32_t komodo_is_notarytx(const CTransaction& tx)
|
int32_t komodo_is_notarytx(const CTransaction& tx)
|
||||||
{
|
{
|
||||||
uint8_t *ptr,crypto777[33];
|
uint8_t *ptr,crypto777[33];
|
||||||
#ifdef KOMODO_ZCASH
|
if ( tx.vout.size() > 0 )
|
||||||
ptr = (uint8_t *)tx.vout[0].scriptPubKey.data();
|
|
||||||
#else
|
|
||||||
ptr = (uint8_t *)&tx.vout[0].scriptPubKey[0];
|
|
||||||
#endif
|
|
||||||
if ( ptr != 0 )
|
|
||||||
{
|
{
|
||||||
decode_hex(crypto777,33,(char *)CRYPTO777_PUBSECPSTR);
|
#ifdef KOMODO_ZCASH
|
||||||
if ( memcmp(ptr+1,crypto777,33) == 0 )
|
ptr = (uint8_t *)tx.vout[0].scriptPubKey.data();
|
||||||
|
#else
|
||||||
|
ptr = (uint8_t *)&tx.vout[0].scriptPubKey[0];
|
||||||
|
#endif
|
||||||
|
if ( ptr != 0 )
|
||||||
{
|
{
|
||||||
//printf("found notarytx\n");
|
decode_hex(crypto777,33,(char *)CRYPTO777_PUBSECPSTR);
|
||||||
return(1);
|
if ( memcmp(ptr+1,crypto777,33) == 0 )
|
||||||
|
{
|
||||||
|
//printf("found notarytx\n");
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
@@ -531,41 +534,47 @@ int32_t komodo_is_notarytx(const CTransaction& tx)
|
|||||||
int32_t komodo_block2height(CBlock *block)
|
int32_t komodo_block2height(CBlock *block)
|
||||||
{
|
{
|
||||||
int32_t i,n,height = 0; uint8_t *ptr;
|
int32_t i,n,height = 0; uint8_t *ptr;
|
||||||
#ifdef KOMODO_ZCASH
|
if ( block->vtx[0].vin.size() > 0 )
|
||||||
ptr = (uint8_t *)block->vtx[0].vin[0].scriptSig.data();
|
|
||||||
#else
|
|
||||||
ptr = (uint8_t *)&block->vtx[0].vin[0].scriptSig[0];
|
|
||||||
#endif
|
|
||||||
if ( ptr != 0 && block->vtx[0].vin[0].scriptSig.size() > 5 )
|
|
||||||
{
|
{
|
||||||
//for (i=0; i<6; i++)
|
#ifdef KOMODO_ZCASH
|
||||||
// printf("%02x",ptr[i]);
|
ptr = (uint8_t *)block->vtx[0].vin[0].scriptSig.data();
|
||||||
n = ptr[0];
|
#else
|
||||||
for (i=0; i<n; i++)
|
ptr = (uint8_t *)&block->vtx[0].vin[0].scriptSig[0];
|
||||||
|
#endif
|
||||||
|
if ( ptr != 0 && block->vtx[0].vin[0].scriptSig.size() > 5 )
|
||||||
{
|
{
|
||||||
//03bb81000101(bb 187) (81 48001) (00 12288256) <- coinbase.6 ht.12288256
|
//for (i=0; i<6; i++)
|
||||||
height += ((uint32_t)ptr[i+1] << (i*8));
|
// printf("%02x",ptr[i]);
|
||||||
//printf("(%02x %x %d) ",ptr[i+1],((uint32_t)ptr[i+1] << (i*8)),height);
|
n = ptr[0];
|
||||||
|
for (i=0; i<n; i++)
|
||||||
|
{
|
||||||
|
//03bb81000101(bb 187) (81 48001) (00 12288256) <- coinbase.6 ht.12288256
|
||||||
|
height += ((uint32_t)ptr[i+1] << (i*8));
|
||||||
|
//printf("(%02x %x %d) ",ptr[i+1],((uint32_t)ptr[i+1] << (i*8)),height);
|
||||||
|
}
|
||||||
|
//printf(" <- coinbase.%d ht.%d\n",(int32_t)block->vtx[0].vin[0].scriptSig.size(),height);
|
||||||
}
|
}
|
||||||
//printf(" <- coinbase.%d ht.%d\n",(int32_t)block->vtx[0].vin[0].scriptSig.size(),height);
|
//komodo_init(height);
|
||||||
}
|
}
|
||||||
//komodo_init(height);
|
|
||||||
return(height);
|
return(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void komodo_block2pubkey33(uint8_t *pubkey33,CBlock& block)
|
void komodo_block2pubkey33(uint8_t *pubkey33,CBlock& block)
|
||||||
{
|
{
|
||||||
int32_t n;
|
int32_t n;
|
||||||
|
memset(pubkey33,0,33);
|
||||||
|
if ( block->vtx[0].vout.size() > 0 )
|
||||||
|
{
|
||||||
#ifdef KOMODO_ZCASH
|
#ifdef KOMODO_ZCASH
|
||||||
uint8_t *ptr = (uint8_t *)block.vtx[0].vout[0].scriptPubKey.data();
|
uint8_t *ptr = (uint8_t *)block.vtx[0].vout[0].scriptPubKey.data();
|
||||||
#else
|
#else
|
||||||
uint8_t *ptr = (uint8_t *)&block.vtx[0].vout[0].scriptPubKey[0];
|
uint8_t *ptr = (uint8_t *)&block.vtx[0].vout[0].scriptPubKey[0];
|
||||||
#endif
|
#endif
|
||||||
//komodo_init(0);
|
//komodo_init(0);
|
||||||
n = block.vtx[0].vout[0].scriptPubKey.size();
|
n = block.vtx[0].vout[0].scriptPubKey.size();
|
||||||
if ( n == 35 )
|
if ( n == 35 )
|
||||||
memcpy(pubkey33,ptr+1,33);
|
memcpy(pubkey33,ptr+1,33);
|
||||||
else memset(pubkey33,0,33);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t komodo_blockload(CBlock& block,CBlockIndex *pindex)
|
int32_t komodo_blockload(CBlock& block,CBlockIndex *pindex)
|
||||||
|
|||||||
Reference in New Issue
Block a user