From 13931733fb0bb55b5f3f0d3635952e5ceaa110c6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 3 Feb 2017 16:10:18 +0200 Subject: [PATCH 1/8] fix --- src/main.cpp | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a6cb252fb..6141f97ea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4343,31 +4343,35 @@ void static ProcessGetData(CNode* pfrom) // Send block from disk CBlock block; if (!ReadBlockFromDisk(block, (*mi).second)) - assert(!"cannot load block from disk"); - if (inv.type == MSG_BLOCK) - pfrom->PushMessage("block", block); - else // MSG_FILTERED_BLOCK) { - LOCK(pfrom->cs_filter); - if (pfrom->pfilter) + assert(!"cannot load block from disk"); + } + else + { + if (inv.type == MSG_BLOCK) + pfrom->PushMessage("block", block); + else // MSG_FILTERED_BLOCK) { - CMerkleBlock merkleBlock(block, *pfrom->pfilter); - pfrom->PushMessage("merkleblock", merkleBlock); - // CMerkleBlock just contains hashes, so also push any transactions in the block the client did not see - // This avoids hurting performance by pointlessly requiring a round-trip - // Note that there is currently no way for a node to request any single transactions we didn't send here - - // they must either disconnect and retry or request the full block. - // Thus, the protocol spec specified allows for us to provide duplicate txn here, - // however we MUST always provide at least what the remote peer needs - typedef std::pair PairType; - BOOST_FOREACH(PairType& pair, merkleBlock.vMatchedTxn) + LOCK(pfrom->cs_filter); + if (pfrom->pfilter) + { + CMerkleBlock merkleBlock(block, *pfrom->pfilter); + pfrom->PushMessage("merkleblock", merkleBlock); + // CMerkleBlock just contains hashes, so also push any transactions in the block the client did not see + // This avoids hurting performance by pointlessly requiring a round-trip + // Note that there is currently no way for a node to request any single transactions we didn't send here - + // they must either disconnect and retry or request the full block. + // Thus, the protocol spec specified allows for us to provide duplicate txn here, + // however we MUST always provide at least what the remote peer needs + typedef std::pair PairType; + BOOST_FOREACH(PairType& pair, merkleBlock.vMatchedTxn) if (!pfrom->setInventoryKnown.count(CInv(MSG_TX, pair.second))) pfrom->PushMessage("tx", block.vtx[pair.first]); - } - // else + } + // else // no response + } } - // Trigger the peer node to send a getblocks request for the next batch of inventory if (inv.hash == pfrom->hashContinue) { From 5304e9459b27b13b8c155f04d5ee93e45f38f1cd Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 3 Feb 2017 16:14:40 +0200 Subject: [PATCH 2/8] test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 6141f97ea..f1443e42a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4344,7 +4344,7 @@ void static ProcessGetData(CNode* pfrom) CBlock block; if (!ReadBlockFromDisk(block, (*mi).second)) { - assert(!"cannot load block from disk"); + //assert(!"cannot load block from disk"); } else { From b34b7b3180d7c348a88705e306994680d5079793 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 3 Feb 2017 16:27:51 +0200 Subject: [PATCH 3/8] test --- src/main.cpp | 2 +- src/pow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f1443e42a..6141f97ea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4344,7 +4344,7 @@ void static ProcessGetData(CNode* pfrom) CBlock block; if (!ReadBlockFromDisk(block, (*mi).second)) { - //assert(!"cannot load block from disk"); + assert(!"cannot load block from disk"); } else { diff --git a/src/pow.cpp b/src/pow.cpp index 59072290d..d19d41be1 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -167,7 +167,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { - if ( nonzpkeys > 0 && height > 182500 && KOMODO_REWIND == 0 && komodo_chainactive(height) != 0 ) + if ( nonzpkeys > 0 && height > 185000 && KOMODO_REWIND == 0 && komodo_chainactive(height) != 0 ) { int32_t i; for (i=31; i>=0; i--) From 752862fdcdb57e40001f11454f5b6d7382a17609 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 3 Feb 2017 16:47:04 +0200 Subject: [PATCH 4/8] test --- src/miner.cpp | 2 +- src/pow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 0f89ca04e..307125da1 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -100,7 +100,7 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, #define ASSETCHAINS_MINHEIGHT 100 #define KOMODO_ELECTION_GAP 2000 -#define ROUNDROBIN_DELAY 58 +#define ROUNDROBIN_DELAY 60 extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE; extern char ASSETCHAINS_SYMBOL[16]; extern std::string NOTARY_PUBKEY; diff --git a/src/pow.cpp b/src/pow.cpp index d19d41be1..59072290d 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -167,7 +167,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { - if ( nonzpkeys > 0 && height > 185000 && KOMODO_REWIND == 0 && komodo_chainactive(height) != 0 ) + if ( nonzpkeys > 0 && height > 182500 && KOMODO_REWIND == 0 && komodo_chainactive(height) != 0 ) { int32_t i; for (i=31; i>=0; i--) From d042777bca863be296a303f1d5b94558e922008d Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 3 Feb 2017 16:56:54 +0200 Subject: [PATCH 5/8] test --- src/main.cpp | 5 +++++ src/pow.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6141f97ea..b33313d30 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3856,8 +3856,13 @@ void UnloadBlockIndex() bool LoadBlockIndex() { // Load block index from databases + KOMODO_LOADINGBLOCKS = 1; if (!fReindex && !LoadBlockIndexDB()) + { + KOMODO_LOADINGBLOCKS = 0; return false; + } + KOMODO_LOADINGBLOCKS = 0; return true; } diff --git a/src/pow.cpp b/src/pow.cpp index 59072290d..5043e98ad 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -114,7 +114,7 @@ extern int32_t KOMODO_CHOSEN_ONE; #define KOMODO_ELECTION_GAP 2000 int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *nonzpkeysp,int32_t height); - +int32_t KOMODO_LOADINGBLOCKS; extern std::string NOTARY_PUBKEY; @@ -167,7 +167,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { - if ( nonzpkeys > 0 && height > 182500 && KOMODO_REWIND == 0 && komodo_chainactive(height) != 0 ) + if ( KOMODO_LOADINGBLOCKS == 0 && nonzpkeys > 0 && height > 182500 && KOMODO_REWIND == 0 && komodo_chainactive(height) != 0 ) { int32_t i; for (i=31; i>=0; i--) From a80ee9c34a9e1d6abf92f2e2606a2dc94889a29f Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 3 Feb 2017 17:02:55 +0200 Subject: [PATCH 6/8] test --- src/pow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pow.cpp b/src/pow.cpp index 5043e98ad..3e8fe6468 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -167,7 +167,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { - if ( KOMODO_LOADINGBLOCKS == 0 && nonzpkeys > 0 && height > 182500 && KOMODO_REWIND == 0 && komodo_chainactive(height) != 0 ) + if ( KOMODO_LOADINGBLOCKS == 0 && height > 182500 && KOMODO_REWIND == 0 )//&& komodo_chainactive(height) != 0 && nonzpkeys > 0 { int32_t i; for (i=31; i>=0; i--) From 5603bd7a208c59e0038f3e8fc2e83c1f0cc20f01 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 3 Feb 2017 17:03:16 +0200 Subject: [PATCH 7/8] test --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.cpp b/src/main.cpp index b33313d30..2defb8571 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3855,6 +3855,7 @@ void UnloadBlockIndex() bool LoadBlockIndex() { + extern int32_t KOMODO_LOADINGBLOCKS; // Load block index from databases KOMODO_LOADINGBLOCKS = 1; if (!fReindex && !LoadBlockIndexDB()) From b6c5b7ec8d1e6c3ee32e6095653392a938880de5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 3 Feb 2017 17:09:16 +0200 Subject: [PATCH 8/8] test --- src/pow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pow.cpp b/src/pow.cpp index 3e8fe6468..eb813087f 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -167,7 +167,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { - if ( KOMODO_LOADINGBLOCKS == 0 && height > 182500 && KOMODO_REWIND == 0 )//&& komodo_chainactive(height) != 0 && nonzpkeys > 0 + if ( KOMODO_LOADINGBLOCKS == 0 && height > 182507 && KOMODO_REWIND == 0 )//&& komodo_chainactive(height) != 0 && nonzpkeys > 0 { int32_t i; for (i=31; i>=0; i--)