This commit is contained in:
jl777
2017-03-21 19:01:19 +02:00
parent 67a128db46
commit 83df5c2a76
3 changed files with 6 additions and 6 deletions

View File

@@ -706,7 +706,7 @@ bool IsStandardTx(const CTransaction& tx, string& reason)
return true; return true;
} }
bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime,int flags)
{ {
static uint32_t grandfathered[] = static uint32_t grandfathered[] =
{ {
@@ -715,7 +715,7 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
int32_t i; int32_t i;
if (tx.nLockTime == 0) if (tx.nLockTime == 0)
return true; return true;
if ( ASSETCHAINS_SYMBOL[0] == 0 && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && (int64_t)tx.nLockTime < nBlockTime-3600 ) if ( ASSETCHAINS_SYMBOL[0] == 0 && flags == STANDARD_LOCKTIME_VERIFY_FLAGS && (int64_t)tx.nLockTime >= LOCKTIME_THRESHOLD && (int64_t)tx.nLockTime < nBlockTime-3600 )
{ {
for (i=0; i<sizeof(grandfathered)/sizeof(*grandfathered); i++) for (i=0; i<sizeof(grandfathered)/sizeof(*grandfathered); i++)
if ( nBlockTime == grandfathered[i] ) if ( nBlockTime == grandfathered[i] )
@@ -771,7 +771,7 @@ bool CheckFinalTx(const CTransaction &tx, int flags)
? chainActive.Tip()->GetMedianTimePast() ? chainActive.Tip()->GetMedianTimePast()
: GetAdjustedTime(); : GetAdjustedTime();
return IsFinalTx(tx, nBlockHeight, nBlockTime); return IsFinalTx(tx, nBlockHeight, nBlockTime,flags);
} }
/** /**
@@ -3292,7 +3292,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(tx, nHeight, nLockTimeCutoff)) { if (!IsFinalTx(tx, nHeight, nLockTimeCutoff,0)) {
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(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime); bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime, int flags);
/** /**
* 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

@@ -201,7 +201,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
? nMedianTimePast ? nMedianTimePast
: pblock->GetBlockTime(); : pblock->GetBlockTime();
if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff)) if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff,STANDARD_LOCKTIME_VERIFY_FLAGS))
continue; continue;
COrphan* porphan = NULL; COrphan* porphan = NULL;