From 253b7bc01daa48a9f259394568fa0a6373fc0635 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 23 Mar 2017 06:46:30 +0200 Subject: [PATCH] Test --- src/main.cpp | 8 ++++---- src/main.h | 2 +- src/miner.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 03224d168..7396530ce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -750,7 +750,7 @@ int32_t komodo_validate_interest(uint32_t *expiredp,const CTransaction& tx,uint3 return(0); } -bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int64_t nBlockTime,int flags) +bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int64_t nBlockTime,int flags,int32_t interesttime) { int32_t i; if ( expiredp != 0 ) @@ -759,7 +759,7 @@ bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int6 return true; if ( ASSETCHAINS_SYMBOL[0] == 0 && flags == STANDARD_LOCKTIME_VERIFY_FLAGS && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD )//&& nBlockTime >= 1473793441 ) //&& (int64_t)tx.nLockTime < nBlockTime-3600 { - if ( komodo_validate_interest(expiredp,tx,nBlockTime) < 0 ) //if ( nBlockTime >= 1490159171 ) // 246748 + if ( komodo_validate_interest(expiredp,tx,interesttime) < 0 ) //if ( nBlockTime >= 1490159171 ) // 246748 { fprintf(stderr,"[%d] IsFinalTx reject.%d locktime %u vs nBlockTime %u\n",(int32_t)(tx.nLockTime-nBlockTime),(int32_t)nBlockHeight,tx.nLockTime,(uint32_t)nBlockTime); return(false); // need to prevent pastdating tx @@ -810,7 +810,7 @@ bool CheckFinalTx(const CTransaction &tx, int flags) ? chainActive.Tip()->GetMedianTimePast() : GetAdjustedTime(); - return IsFinalTx(0,tx, nBlockHeight, nBlockTime,flags); + return IsFinalTx(0,tx, nBlockHeight, nBlockTime,flags,chainActive.Tip()->nTime); } /** @@ -3361,7 +3361,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn int64_t nLockTimeCutoff = (nLockTimeFlags & LOCKTIME_MEDIAN_TIME_PAST) ? pindexPrev->GetMedianTimePast() : block.GetBlockTime(); - if (!IsFinalTx(0,tx, nHeight, nLockTimeCutoff,0*STANDARD_LOCKTIME_VERIFY_FLAGS)) { + if (!IsFinalTx(0,tx, nHeight, nLockTimeCutoff,0*STANDARD_LOCKTIME_VERIFY_FLAGS,pindexPrev->nTime)) { return state.DoS(10, error("%s: contains a non-final transaction", __func__), REJECT_INVALID, "bad-txns-nonfinal"); } } diff --git a/src/main.h b/src/main.h index dcbd23632..1bea5030f 100644 --- a/src/main.h +++ b/src/main.h @@ -351,7 +351,7 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason); * Check if transaction is final and can be included in a block with the * specified height and time. Consensus critical. */ -bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int64_t nBlockTime, int flags); +bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int64_t nBlockTime, int flags,int32_t interesttime); /** * Check if transaction will be final in the next block to be created. diff --git a/src/miner.cpp b/src/miner.cpp index be3153c57..ee7c608b2 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -202,7 +202,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) ? nMedianTimePast : pblock->GetBlockTime(); - if (tx.IsCoinBase() || !IsFinalTx(&expired,tx, nHeight, nLockTimeCutoff,STANDARD_LOCKTIME_VERIFY_FLAGS)) + if (tx.IsCoinBase() || !IsFinalTx(&expired,tx, nHeight, nLockTimeCutoff,STANDARD_LOCKTIME_VERIFY_FLAGS,chainActive.Tip()->nTime)) { if ( expired != 0 ) {