From 2f852a342cb91ebfd165f3f5b601b8dfe7040998 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 24 Mar 2017 05:59:38 +0200 Subject: [PATCH 1/6] Test --- src/main.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 7292781cb..c34abde92 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -723,17 +723,22 @@ int32_t komodo_validate_interest(uint32_t *expiredp,const CTransaction& tx,int32 if ( (pindex= mapBlockIndex[hashBlock]) != 0 ) { txheight = pindex->nHeight; + prevblocktime = pindex->nTime; if ( (previndex= pindex->pprev) != 0 ) prevblocktime = previndex->nTime; } } - if ( prevblocktime != 0 ) - cmptime = prevblocktime + 600; - else if ( txheight > 246748 ) + if ( prevblocktime == 0 ) { - //fprintf(stderr,"couldnt get cmptime for [%d] t%u\n",txheight,prevblocktime); - return(-1); - } else return(0); + if ( activeChain.Tip() != 0 && height == activeChain.Tip()->nHeight+1 ) + prevblocktime = activeChain.Tip()->nTime; + else + { + fprintf(stderr,"couldnt get prevblocktime for [%d]\n",txheight); + return(-1); + } + } + cmptime = prevblocktime + 600; /* uint32_t prevblocktime=0,cmptime=0,txheighttime=0,tiptime=0,locktime=0; prevblocktime = 0; locktime = komodo_interest_args(&txheighttime,&txheight,&tiptime,&value,tx.GetHash(),0); From 5aa4223f1ef832f8909231efe94cd972560724f3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 24 Mar 2017 06:03:46 +0200 Subject: [PATCH 2/6] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index c34abde92..ce4ba6967 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -384,7 +384,7 @@ void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) { ProcessBlockAvailability(nodeid); BlockMap::iterator it = mapBlockIndex.find(hash); - if (it->second != 0 && it != mapBlockIndex.end() && it->second->nChainWork > 0) { + if (it->size() != 0 && it != mapBlockIndex.end() && it->second->nChainWork > 0) { // An actually better block was announced. if (state->pindexBestKnownBlock == NULL || it->second->nChainWork >= state->pindexBestKnownBlock->nChainWork) state->pindexBestKnownBlock = it->second; From f4ad37c5473bb7a79cee4809349e5d1caf3d124a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 24 Mar 2017 06:04:52 +0200 Subject: [PATCH 3/6] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index ce4ba6967..114280ef0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -730,7 +730,7 @@ int32_t komodo_validate_interest(uint32_t *expiredp,const CTransaction& tx,int32 } if ( prevblocktime == 0 ) { - if ( activeChain.Tip() != 0 && height == activeChain.Tip()->nHeight+1 ) + if ( chainActive.Tip.Tip() != 0 && txheight == chainActive.Tip.Tip()->nHeight+1 ) prevblocktime = activeChain.Tip()->nTime; else { From 354dc58a3bb4f348521fea4c9ebb436ef80066a2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 24 Mar 2017 06:05:51 +0200 Subject: [PATCH 4/6] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 114280ef0..f6c30f2a7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -730,8 +730,8 @@ int32_t komodo_validate_interest(uint32_t *expiredp,const CTransaction& tx,int32 } if ( prevblocktime == 0 ) { - if ( chainActive.Tip.Tip() != 0 && txheight == chainActive.Tip.Tip()->nHeight+1 ) - prevblocktime = activeChain.Tip()->nTime; + if ( chainActive.Tip() != 0 && txheight == chainActive.Tip()->nHeight+1 ) + prevblocktime = chainActive.Tip()->nTime; else { fprintf(stderr,"couldnt get prevblocktime for [%d]\n",txheight); From 3d8d574eacfab05c4f09f6a7925fb31a9eb16f78 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 24 Mar 2017 06:06:45 +0200 Subject: [PATCH 5/6] Test --- src/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f6c30f2a7..812095d0e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -381,14 +381,14 @@ void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) { CNodeState *state = State(nodeid); assert(state != NULL); - ProcessBlockAvailability(nodeid); + /*ProcessBlockAvailability(nodeid); BlockMap::iterator it = mapBlockIndex.find(hash); - if (it->size() != 0 && it != mapBlockIndex.end() && it->second->nChainWork > 0) { + if (it != mapBlockIndex.end() && it->second->nChainWork > 0) { // An actually better block was announced. if (state->pindexBestKnownBlock == NULL || it->second->nChainWork >= state->pindexBestKnownBlock->nChainWork) state->pindexBestKnownBlock = it->second; - } else + } else*/ { // An unknown block was announced; just assume that the latest one is the best one. state->hashLastUnknownBlock = hash; From a7869456aca4f3e2faa0c5ee5176b033ead01e57 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 24 Mar 2017 06:12:46 +0200 Subject: [PATCH 6/6] Test --- src/main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 812095d0e..6b430e387 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -734,8 +734,9 @@ int32_t komodo_validate_interest(uint32_t *expiredp,const CTransaction& tx,int32 prevblocktime = chainActive.Tip()->nTime; else { - fprintf(stderr,"couldnt get prevblocktime for [%d]\n",txheight); - return(-1); + prevblocktime = chainActive.Tip()->nTime; + fprintf(stderr,"couldnt get prevblocktime for [%d] use tiptime.%u\n",txheight,prevblocktime); + //return(-1); } } cmptime = prevblocktime + 600;