From 4d2a1fc3614842b6d9c9bea54a3e7feb02945899 Mon Sep 17 00:00:00 2001 From: Team ChainStrike Date: Sun, 30 Sep 2018 03:39:43 +1000 Subject: [PATCH 1/3] Use CTransaction isNull method instead of &tx!=0 which is always true --- src/komodo_validation011.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/komodo_validation011.h b/src/komodo_validation011.h index 64caffcc6..286840844 100644 --- a/src/komodo_validation011.h +++ b/src/komodo_validation011.h @@ -108,20 +108,18 @@ int32_t gettxout_scriptPubKey(int32_t height,uint8_t *scriptPubKey,int32_t maxsi } } - if ( &tx != 0 && 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 voutsize.%d\n",height,n,(int32_t)tx.vout.size()); return(-1); @@ -776,7 +774,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; } From e9a9ae0954227797ee5717ab281e946000ae9ae3 Mon Sep 17 00:00:00 2001 From: Team ChainStrike Date: Sun, 30 Sep 2018 04:13:44 +1000 Subject: [PATCH 2/3] Less noise and only print some thing on notary nodes --- src/komodo_validation011.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_validation011.h b/src/komodo_validation011.h index 286840844..6a4e8a007 100644 --- a/src/komodo_validation011.h +++ b/src/komodo_validation011.h @@ -999,7 +999,6 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n void komodo_notarized_update(int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth) { static int didinit; static uint256 zero; static FILE *fp; CBlockIndex *pindex; struct notarized_checkpoint *np,N; long fpos; - LogPrintf("dpow: komodod_notarized_update\n"); if ( didinit == 0 ) { char fname[512];int32_t latestht = 0; @@ -1094,7 +1093,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 ) From c9c321e88399ad2eb885ee623686725514a04a3a Mon Sep 17 00:00:00 2001 From: Team ChainStrike Date: Sun, 30 Sep 2018 18:59:49 +1000 Subject: [PATCH 3/3] Basic passing dpow test, run like: ./qa/pull-tester/rpc-tests.sh dpow --- qa/rpc-tests/dpow.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/qa/rpc-tests/dpow.py b/qa/rpc-tests/dpow.py index 8c78b92cf..cf56d1ff5 100755 --- a/qa/rpc-tests/dpow.py +++ b/qa/rpc-tests/dpow.py @@ -25,12 +25,13 @@ class DPoWTest(BitcoinTestFramework): self.nodes[0].generate(3) rpc = self.nodes[0] - # Verify that basic RPC functions exist and work - result = rpc.calc_MoM(2,20) - print result - result = rpc.getinfo() - assert result.notarized,42 + print result + # TODO: actually do notarizations on regtest and test for specific data + # TODO: does this have mainnet values somehow? + assert(result['notarized'] >= 0) + assert(result['notarizedhash']) + assert(result['notarizedtxid']) if __name__ == '__main__': DPoWTest().main()