Only track locks with explicit asset types that are bitcoin

This commit is contained in:
Gregory Sanders 2017-05-15 11:16:08 -04:00
parent 0fca8a94d0
commit a288fff697

View file

@ -2526,7 +2526,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
vPos.push_back(std::make_pair(tx.GetHash(), pos));
for (unsigned int i = 0; i < tx.vout.size(); i++) {
CTxOut txout= tx.vout[i];
if (txout.scriptPubKey.IsWithdrawLock() && txout.nValue.IsExplicit())
if (txout.scriptPubKey.IsWithdrawLock() && txout.nValue.IsExplicit() && txout.nAsset.IsExplicit() && txout.nAsset.GetAsset() == BITCOINID)
mLocksCreated.insert(std::make_pair(txout.scriptPubKey.GetWithdrawLockGenesisHash(), std::make_pair(COutPoint(tx.GetHash(), i), txout.nValue.GetAmount())));
}
@ -2718,8 +2718,9 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
for (unsigned int j = 0; j < tx.vout.size(); j++) {
CTxOut txout = tx.vout[j];
if (txout.scriptPubKey.IsWithdrawLock() && txout.nValue.IsExplicit())
if (txout.scriptPubKey.IsWithdrawLock() && txout.nValue.IsExplicit() && txout.nAsset.IsExplicit() && txout.nAsset.GetAsset() == BITCOINID) {
mLocksCreated.insert(std::make_pair(txout.scriptPubKey.GetWithdrawLockGenesisHash(), std::make_pair(COutPoint(tx.GetHash(), j), txout.nValue.GetAmount())));
}
}
if (!tx.HasValidFee())
return state.DoS(100, error("ConnectBlock(): transaction fee overflowed"), REJECT_INVALID, "bad-fee-outofrange");