8000 Reformat asset amount checks and custom error msg · etherscan-io/Ravencoin@d23f862 · GitHub
[go: up one dir, main page]

Skip to content

Commit d23f862

Browse files
WindowsCryptoDevblondfrogs
authored andcommitted
Reformat asset amount checks and custom error msg
1 parent 579469c commit
8000
 d23f862

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/consensus/tx_verify.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fChe
259259
bool fIsOwner;
260260
if (txout.scriptPubKey.IsAssetScript(nType, fIsOwner))
261261
isAsset = true;
262-
263-
// Make sure that all asset tx have a nValue of zero RVN
264-
if (isAsset && txout.nValue != 0)
265-
return state.DoS(100, false, REJECT_INVALID, "bad-txns-asset-tx-amount-isn't-zero");
266-
262+
267263
// Check for transfers that don't meet the assets units only if the assetCache is not null
268264
if (isAsset) {
269265
// Get the transfer transaction data from the scriptPubKey
@@ -304,6 +300,14 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fChe
304300
if (transfer.nAmount < QUALIFIER_ASSET_MIN_AMOUNT || transfer.nAmount > QUALIFIER_ASSET_MAX_AMOUNT)
305301
return state.DoS(100, false, REJECT_INVALID, "bad-txns-transfer-qualifier-amount-must be between 1 - 100");
306302
}
303+
304+
// Specific check and error message to go with to make sure the amount is 0
305+
if (txout.nValue != 0)
306+
return state.DoS(100, false, REJECT_INVALID, "bad-txns-asset-transfer-amount-isn't-zero");
307+
} else if (nType == TX_NEW_ASSET) {
308+
// Specific check and error message to go with to make sure the amount is 0
309+
if (txout.nValue != 0)
310+
return state.DoS(100, false, REJECT_INVALID, "bad-txns-asset-issued-amount-isn't-zero");
307311
}
308312
}
309313
}

0 commit comments

Comments
 (0)
0