From 2f14564c79a2050738bedca23bfb4422c2335125 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Mon, 5 Nov 2018 20:15:48 +0100 Subject: [PATCH] Notarizations in regtest. Every 7th block is notarized in regtest --- qa/rpc-tests/dpowconfs.py | 6 +++++- src/komodo_validation011.h | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/qa/rpc-tests/dpowconfs.py b/qa/rpc-tests/dpowconfs.py index 8403f0960..5395ade35 100755 --- a/qa/rpc-tests/dpowconfs.py +++ b/qa/rpc-tests/dpowconfs.py @@ -22,7 +22,11 @@ class DPoWConfsTest(BitcoinTestFramework): self.sync_all() def run_test(self): - self.nodes[0].generate(101) + rpc = self.nodes[0] + rpc.generate(8) + print rpc.getinfo() + self.nodes[0].generate(94) + print rpc.getinfo() rpc = self.nodes[0] result = rpc.listunspent() diff --git a/src/komodo_validation011.h b/src/komodo_validation011.h index 0dba18e5f..878bbb661 100644 --- a/src/komodo_validation011.h +++ b/src/komodo_validation011.h @@ -1172,6 +1172,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) { static int32_t hwmheight; uint64_t signedmask; uint8_t scriptbuf[4096],pubkeys[64][33],scriptPubKey[35]; uint256 zero; int32_t i,j,k,m,numnotaries,notarized,scriptlen,numvalid,specialtx,notarizedheight,len,numvouts,numvins,height,txn_count; + uint256 txhash; if ( KOMODO_NEEDPUBKEYS != 0 ) { @@ -1197,7 +1198,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) //fprintf(stderr, "txn_count=%d\n", txn_count); for (i=0; iGetHash(); + txhash = block.vtx[i].GetHash(); numvouts = block.vtx[i].vout.size(); specialtx = notarizedheight = notarized = 0; signedmask = 0; @@ -1224,8 +1225,12 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) numvalid = bitweight(signedmask); if ( numvalid >= KOMODO_MINRATIFY ) notarized = 1; - if ( Params().NetworkIDString() == "regtest" && ( height%7 == 0) ) + if ( Params().NetworkIDString() == "regtest" && ( height%7 == 0) ) { notarized = 1; + NOTARIZED_HEIGHT = height; + //NOTARIZED_HASH = hash; + NOTARIZED_DESTTXID = txhash; + } if ( IS_NOTARY ) LogPrint("dpow","(tx.%d: ",i); for (j=0; j