From d9b696bb26c0eadfed6291a70d6e7f7833db8113 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 9 Apr 2018 17:04:39 +0300 Subject: [PATCH] Test --- src/komodo_gateway.h | 2 +- src/main.cpp | 2 +- src/wallet/rpcwallet.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 2953a8cbc..773d35402 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -675,7 +675,7 @@ int32_t komodo_stake(int32_t nHeight,uint256 hash,int32_t n,uint32_t blocktime,u uint32_t txtime,minutes; uint64_t value; txtime = komodo_txtime(&value,hash,n); minutes = (blocktime - txtime) / 60; - fprintf(stderr,"txtime.%u blocktime.%u prev.%u gap.%d minutes.%d %.8f\n",txtime,blocktime,prevtime,(int32_t)(blocktime - prevtime),minutes,dstr(value)); + fprintf(stderr,"ht.%d txtime.%u blocktime.%u prev.%u gap.%d minutes.%d %.8f\n",nHeight,txtime,blocktime,prevtime,(int32_t)(blocktime - prevtime),minutes,dstr(value)); if ( nHeight < 200 ) return(1); else return(0); diff --git a/src/main.cpp b/src/main.cpp index 4008f61e9..4639814de 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3493,7 +3493,7 @@ bool CheckBlockHeader(int32_t height,CBlockIndex *pindex, const CBlockHeader& bl } if (blockhdr.GetBlockTime() > GetAdjustedTime() + 60) return state.Invalid(error("CheckBlockHeader(): block timestamp too far in the future"),REJECT_INVALID, "time-too-new"); - else if ( ASSETCHAINS_STAKED != 0 && pindex->nTime <= pindex->pprev->nTime ) + else if ( ASSETCHAINS_STAKED != 0 && pindex != 0 && pindex->pprev != 0 && pindex->nTime <= pindex->pprev->nTime ) { fprintf(stderr,"ht.%d %u vs ht.%d %u, is not monotonic\n",pindex->nHeight,pindex->nTime,pindex->pprev->nHeight,pindex->pprev->nTime); return state.Invalid(error("CheckBlockHeader(): block timestamp needs to always increase"),REJECT_INVALID, "time-too-new"); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 06424bc9f..31ad605f9 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4499,8 +4499,8 @@ int32_t komodo_staked(uint32_t *blocktimep,uint32_t *txtimep,uint256 *utxotxidp, komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue,(int32_t)tipindex->nHeight); interest = komodo_interest(txheight,nValue,out.tx->nLockTime,tipindex->nTime); //entry.push_back(Pair("interest",ValueFromAmount(interest))); + komodo_stake((uint32_t)tipindex->nHeight+1,out.tx->GetHash(),out.i,*blocktimep,(uint32_t)tipindex->nTime); } - komodo_stake((uint32_t)chainActive.Tip()->nHeight+1,out.tx->GetHash(),out.i,*blocktimep,(uint32_t)chainActive.Tip()->nTime); //fprintf(stderr,"(%s) %s/v%d nValue %.8f locktime.%u txheight.%d pindexht.%d\n",CBitcoinAddress(address).ToString().c_str(),out.tx->GetHash().GetHex().c_str(),out.i,(double)nValue/COIN,locktime,txheight,pindex->nHeight); } bool signSuccess; SignatureData sigdata; uint64_t txfee; uint8_t *ptr; uint256 revtxid,utxotxid;