Skip to content

Commit

Permalink
Fix token check bugs from #2582
Browse files Browse the repository at this point in the history
  • Loading branch information
prasannavl committed Oct 24, 2023
1 parent 2cc5a7d commit 4d80d42
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/dfi/consensus/tokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
#include <dfi/mn_checks.h>

Res CTokensConsensus::CheckTokenCreationTx() const {
if (tx.vout.size() < 2 || tx.vout[0].nValue < GetTokenCreationFee(height) || tx.vout[0].nTokenId != DCT_ID{0} ||
tx.vout[1].nValue != GetTokenCollateralAmount() || tx.vout[1].nTokenId != DCT_ID{0},
"malformed tx vouts (wrong creation fee or collateral amount)") {
;
if (tx.vout.size() < 2 ||
tx.vout[0].nValue < GetTokenCreationFee(height) ||
tx.vout[0].nTokenId != DCT_ID{0} ||
tx.vout[1].nValue != GetTokenCollateralAmount() ||
tx.vout[1].nTokenId != DCT_ID{0}) {
return Res::Err("malformed tx vouts (wrong creation fee or collateral amount)");
}

return Res::Ok();
Expand Down

0 comments on commit 4d80d42

Please sign in to comment.