|
|
@ -1325,19 +1325,8 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex) |
|
|
|
// This logic is not necessary for memory pool transactions, as AcceptToMemoryPool
|
|
|
|
// This logic is not necessary for memory pool transactions, as AcceptToMemoryPool
|
|
|
|
// already refuses previously-known transaction id's entirely.
|
|
|
|
// already refuses previously-known transaction id's entirely.
|
|
|
|
// This rule applies to all blocks whose timestamp is after March 15, 2012, 0:00 UTC.
|
|
|
|
// This rule applies to all blocks whose timestamp is after March 15, 2012, 0:00 UTC.
|
|
|
|
if (pindex->nTime > 1331769600) |
|
|
|
int64 nBIP30SwitchTime = 1331769600; |
|
|
|
{ |
|
|
|
bool fEnforceBIP30 = (pindex->nTime > nBIP30SwitchTime); |
|
|
|
BOOST_FOREACH(CTransaction& tx, vtx) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
CTxIndex txindexOld; |
|
|
|
|
|
|
|
if (txdb.ReadTxIndex(tx.GetHash(), txindexOld)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
BOOST_FOREACH(CDiskTxPos &pos, txindexOld.vSpent) |
|
|
|
|
|
|
|
if (pos.IsNull()) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// BIP16 didn't become active until Apr 1 2012
|
|
|
|
// BIP16 didn't become active until Apr 1 2012
|
|
|
|
int64 nBIP16SwitchTime = 1333238400; |
|
|
|
int64 nBIP16SwitchTime = 1333238400; |
|
|
@ -1351,6 +1340,17 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex) |
|
|
|
unsigned int nSigOps = 0; |
|
|
|
unsigned int nSigOps = 0; |
|
|
|
BOOST_FOREACH(CTransaction& tx, vtx) |
|
|
|
BOOST_FOREACH(CTransaction& tx, vtx) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
uint256 hashTx = tx.GetHash(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (fEnforceBIP30) { |
|
|
|
|
|
|
|
CTxIndex txindexOld; |
|
|
|
|
|
|
|
if (txdb.ReadTxIndex(hashTx, txindexOld)) { |
|
|
|
|
|
|
|
BOOST_FOREACH(CDiskTxPos &pos, txindexOld.vSpent) |
|
|
|
|
|
|
|
if (pos.IsNull()) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
nSigOps += tx.GetLegacySigOpCount(); |
|
|
|
nSigOps += tx.GetLegacySigOpCount(); |
|
|
|
if (nSigOps > MAX_BLOCK_SIGOPS) |
|
|
|
if (nSigOps > MAX_BLOCK_SIGOPS) |
|
|
|
return DoS(100, error("ConnectBlock() : too many sigops")); |
|
|
|
return DoS(100, error("ConnectBlock() : too many sigops")); |
|
|
@ -1381,7 +1381,7 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mapQueuedChanges[tx.GetHash()] = CTxIndex(posThisTx, tx.vout.size()); |
|
|
|
mapQueuedChanges[hashTx] = CTxIndex(posThisTx, tx.vout.size()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Write queued txindex changes
|
|
|
|
// Write queued txindex changes
|
|
|
|