Browse Source

Merge pull request #139 from chainstrike/dev

Use CTransaction isNull method instead of &tx!=0 which is always true
pull/129/merge
Duke Leto 6 years ago
committed by GitHub
parent
commit
fd60127c20
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      qa/rpc-tests/dpow.py
  2. 13
      src/komodo_validation011.h

1
qa/rpc-tests/dpow.py

@ -28,6 +28,7 @@ class DPoWTest(BitcoinTestFramework):
result = rpc.getinfo()
print result
# TODO: actually do notarizations on regtest and test for specific data
# regtest should have no notarization data, this test makes sure we do not see mainnet values as well!
assert_equal(result['notarized'],0)
assert_equal(result['notarizedhash'],'0000000000000000000000000000000000000000000000000000000000000000')

13
src/komodo_validation011.h

@ -109,20 +109,18 @@ int32_t gettxout_scriptPubKey(int32_t height,uint8_t *scriptPubKey,int32_t maxsi
}
}
if ( n >= 0 && n < (int32_t)tx.vout.size() )
if ( !tx.IsNull() && n >= 0 && n < (int32_t)tx.vout.size() )
{
ptr = (uint8_t *)tx.vout[n].scriptPubKey.data();
m = tx.vout[n].scriptPubKey.size();
for (i=0; i<maxsize&&i<m; i++) {
//fprintf(stderr,"%02x",ptr[i]);
scriptPubKey[i] = ptr[i];
}
//fprintf(stderr,"\n");
}
fprintf(stderr,"got scriptPubKey[%d] via rawtransaction ht.%d %s\n",m,height,txid.GetHex().c_str());
return(i);
}
else
else if ( !tx.IsNull() )
fprintf(stderr,"gettxout_scriptPubKey ht.%d n.%d > voutsize.%d\n",height,n,(int32_t)tx.vout.size());
return(-1);
@ -777,7 +775,7 @@ int32_t komodo_init()
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());
if ( GetBoolArg("-txindex", DEFAULT_TXINDEX) == 0 )
{
fprintf(stderr,"txindex is off, import notary pubkeys\n");
//fprintf(stderr,"txindex is off, import notary pubkeys\n");
KOMODO_NEEDPUBKEYS = 1;
KOMODO_TXINDEX = 0;
}
@ -1099,7 +1097,8 @@ int32_t komodo_checkpoint(int32_t *notarized_heightp,int32_t nHeight,uint256 has
if ( notarized_height >= 0 && notarized_height <= pindex->nHeight && mapBlockIndex.count(notarized_hash) != 0 )
{
notary = mapBlockIndex[notarized_hash];
printf("nHeight.%d -> (%d %s)\n",pindex->nHeight,notarized_height,notarized_hash.ToString().c_str());
if ( IS_NOTARY )
printf("nHeight.%d -> (%d %s)\n",pindex->nHeight,notarized_height,notarized_hash.ToString().c_str());
if ( notary->nHeight == notarized_height ) // if notarized_hash not in chain, reorg
{
if ( nHeight < notarized_height )

Loading…
Cancel
Save