Merge pull request #410 from jl777/dev

Dev
This commit is contained in:
jl777
2017-04-10 15:47:06 +03:00
committed by GitHub
4 changed files with 12 additions and 9 deletions

View File

@@ -720,6 +720,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
} }
//fprintf(stderr,"ht.%d n.%d nValue %.8f (%d %d %d)\n",height,n,dstr(block.vtx[0].vout[1].nValue),KOMODO_PAX,komodo_isrealtime(&ht),KOMODO_PASSPORT_INITDONE); //fprintf(stderr,"ht.%d n.%d nValue %.8f (%d %d %d)\n",height,n,dstr(block.vtx[0].vout[1].nValue),KOMODO_PAX,komodo_isrealtime(&ht),KOMODO_PASSPORT_INITDONE);
offset += komodo_scriptitemlen(&opretlen,&script[offset]); offset += komodo_scriptitemlen(&opretlen,&script[offset]);
//printf("offset.%d opretlen.%d [%02x %02x %02x %02x]\n",offset,opretlen,script[0],script[1],script[2],script[3]);
if ( ASSETCHAINS_SYMBOL[0] == 0 ) if ( ASSETCHAINS_SYMBOL[0] == 0 )
{ {
opcode = 'X'; opcode = 'X';
@@ -1006,8 +1007,8 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above
{ {
for (i=0; i<opretlen&&i<100; i++) for (i=0; i<opretlen&&i<100; i++)
printf("%02x",script[i]); printf("%02x",script[i]);
printf(" height.%d checkdeposit n.%d [%02x] [%c] %d len.%d ",height,n,script[0],script[offset],script[offset],opretlen); printf(" height.%d checkdeposit n.%d [%02x] [%c] %d opcode.%d len.%d ",height,n,script[0],script[offset],script[offset],opcode,opretlen);
printf("not proper vout with opreturn format %s ht.%d\n",ASSETCHAINS_SYMBOL,height); printf("not proper vout with opreturn format %s ht.%d cmp.%d %d\n",ASSETCHAINS_SYMBOL,height,script[offset] == opcode,(int32_t)block.vtx[0].vout[n-1].scriptPubKey.size());
return(-1); return(-1);
} }
return(0); return(0);

View File

@@ -977,8 +977,10 @@ int32_t komodo_scriptitemlen(int32_t *opretlenp,uint8_t *script)
opretlen = script[len++]; opretlen = script[len++];
else if ( opretlen == 0x4d ) else if ( opretlen == 0x4d )
{ {
opretlen = script[len++]; opretlen = script[len] + (script[len+1] << 8);
opretlen = (opretlen << 8) | script[len++]; len += 2;
//opretlen = script[len++];
//opretlen = (opretlen << 8) | script[len++];
} }
} }
*opretlenp = opretlen; *opretlenp = opretlen;

View File

@@ -3552,7 +3552,7 @@ bool TestBlockValidity(CValidationState &state, const CBlock& block, CBlockIndex
} }
if (!CheckBlock(indexDummy.nHeight,0,block, state, verifier, fCheckPOW, fCheckMerkleRoot)) if (!CheckBlock(indexDummy.nHeight,0,block, state, verifier, fCheckPOW, fCheckMerkleRoot))
{ {
fprintf(stderr,"TestBlockValidity failure B\n"); //fprintf(stderr,"TestBlockValidity failure B\n");
return false; return false;
} }
if (!ContextualCheckBlock(block, state, pindexPrev)) if (!ContextualCheckBlock(block, state, pindexPrev))

View File

@@ -135,7 +135,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
return NULL; return NULL;
} }
CBlock *pblock = &pblocktemplate->block; // pointer for convenience CBlock *pblock = &pblocktemplate->block; // pointer for convenience
if ( ASSETCHAINS_SYMBOL[0] != 0 && chainActive.Tip()->nHeight >= ASSETCHAINS_MINHEIGHT ) if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 && chainActive.Tip()->nHeight >= ASSETCHAINS_MINHEIGHT )
{ {
isrealtime = komodo_isrealtime(&kmdheight); isrealtime = komodo_isrealtime(&kmdheight);
deposits = komodo_paxtotal(); deposits = komodo_paxtotal();
@@ -549,7 +549,7 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
script[34] = OP_CHECKSIG; script[34] = OP_CHECKSIG;
//scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG; //scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG;
} }
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) if ( 1 && ASSETCHAINS_SYMBOL[0] != 0 )
{ {
for (i=0; i<65; i++) for (i=0; i<65; i++)
fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i,0)); fprintf(stderr,"%d ",komodo_minerid(chainActive.Tip()->nHeight-i,0));
@@ -708,7 +708,7 @@ void static BitcoinMiner()
Mining_height = pindexPrev->nHeight+1; Mining_height = pindexPrev->nHeight+1;
Mining_start = (uint32_t)time(NULL); Mining_start = (uint32_t)time(NULL);
} }
if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) if ( 1 && ASSETCHAINS_SYMBOL[0] != 0 )
fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height); fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height);
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey); CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey);
@@ -736,7 +736,7 @@ void static BitcoinMiner()
CBlock *pblock = &pblocktemplate->block; CBlock *pblock = &pblocktemplate->block;
if ( ASSETCHAINS_SYMBOL[0] != 0 ) if ( ASSETCHAINS_SYMBOL[0] != 0 )
{ {
if ( pblock->vtx.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT ) if ( pblock->vtx.size() == 1 && pblock->vtx[0].vout.size() == 1 && Mining_height > ASSETCHAINS_MINHEIGHT )
{ {
static uint32_t counter; static uint32_t counter;
if ( counter++ < 10 ) if ( counter++ < 10 )