Skip to content

Commit

Permalink
fix duplicate unqiue in same tx
Browse files Browse the repository at this point in the history
  • Loading branch information
blondfrogs authored and blondfrogs committed Oct 22, 2018
1 parent 2f958d8 commit 4f5f87c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/assets/assets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,10 @@ bool CTransaction::VerifyNewUniqueAsset(std::string& strError) const
}

// check for (and count) new unique asset outpoints. make sure they share a root.
std::set<std::string> setUniqueAssets;
std::string assetRoot = "";
int assetOutpointCount = 0;

for (auto out : vout) {
if (IsScriptNewUniqueAsset(out.scriptPubKey)) {
CNewAsset asset;
Expand All @@ -770,6 +772,14 @@ bool CTransaction::VerifyNewUniqueAsset(std::string& strError) const
strError = "bad-txns-issue-unique-asset-compare-failed";
return false;
}

// Check for duplicate unique assets in the same transaction
if (setUniqueAssets.count(asset.strName)) {
strError = "bad-txns-issue-unique-duplicate-name-in-same-tx";
return false;
}

setUniqueAssets.insert(asset.strName);
assetOutpointCount += 1;
}
}
Expand Down

0 comments on commit 4f5f87c

Please sign in to comment.