This commit is contained in:
jl777
2017-03-23 06:46:30 +02:00
parent 3915943450
commit 253b7bc01d
3 changed files with 6 additions and 6 deletions

View File

@@ -750,7 +750,7 @@ int32_t komodo_validate_interest(uint32_t *expiredp,const CTransaction& tx,uint3
return(0); 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; int32_t i;
if ( expiredp != 0 ) if ( expiredp != 0 )
@@ -759,7 +759,7 @@ bool IsFinalTx(uint32_t *expiredp,const CTransaction &tx, int nBlockHeight, int6
return true; 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 ( 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); 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 return(false); // need to prevent pastdating tx
@@ -810,7 +810,7 @@ bool CheckFinalTx(const CTransaction &tx, int flags)
? chainActive.Tip()->GetMedianTimePast() ? chainActive.Tip()->GetMedianTimePast()
: GetAdjustedTime(); : 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) int64_t nLockTimeCutoff = (nLockTimeFlags & LOCKTIME_MEDIAN_TIME_PAST)
? pindexPrev->GetMedianTimePast() ? pindexPrev->GetMedianTimePast()
: block.GetBlockTime(); : 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"); return state.DoS(10, error("%s: contains a non-final transaction", __func__), REJECT_INVALID, "bad-txns-nonfinal");
} }
} }

View File

@@ -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 * Check if transaction is final and can be included in a block with the
* specified height and time. Consensus critical. * 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. * Check if transaction will be final in the next block to be created.

View File

@@ -202,7 +202,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
? nMedianTimePast ? nMedianTimePast
: pblock->GetBlockTime(); : 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 ) if ( expired != 0 )
{ {