This commit is contained in:
jl777
2016-10-20 10:12:42 -03:00
parent 3125ef3705
commit bc556d7e13

View File

@@ -526,13 +526,14 @@ int32_t komodo_heightnotary(int32_t height,uint8_t *pubkey33)
int32_t komodo_block2height(CBlock *block) int32_t komodo_block2height(CBlock *block)
{ {
int32_t i,height = 0; uint8_t *ptr = (uint8_t *)block->vtx[0].vin[0].scriptSig.data(); int32_t i,n,height = 0; uint8_t *ptr = (uint8_t *)block->vtx[0].vin[0].scriptSig.data();
if ( block->vtx[0].vin[0].scriptSig.size() > 5 ) if ( block->vtx[0].vin[0].scriptSig.size() > 5 )
{ {
for (i=0; i<6; i++) for (i=0; i<6; i++)
printf("%02x",ptr[i]); printf("%02x",ptr[i]);
for (i=0; i<4; i++) n = ptr[0];
height = (height << 8) + ptr[i+2]; for (i=0; i<n; i++)
height = (height << 8) + ptr[i+1];
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);
} }
return(height); return(height);