Skip to content

Commit

Permalink
Bump NFT token data size to 96k
Browse files Browse the repository at this point in the history
  • Loading branch information
celbalrai authored and wagerr-builder committed May 4, 2022
1 parent b75cc5c commit 59a4007
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/consensus/consensus.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ inline unsigned int MaxBlockSigOps(bool fDIP0001Active = true)
}
/** The maximum allowed size of version 3 extra payload */
static const unsigned int MAX_TX_EXTRA_PAYLOAD = 10000;
/** The maximum allowed size of version 3 NFT extra payload */
static const unsigned int MAX_TX_EXTRA_NFT_PAYLOAD = 99616;
/** The maximum size of NFT token data */
static const unsigned int MAX_TX_NFT_DATA = 8000;
static const unsigned int MAX_TX_NFT_DATA = 98300;

/** Flags for nSequence and nLockTime locks */
/** Interpret sequence numbers as relative lock-time constraints. */
Expand Down
10 changes: 8 additions & 2 deletions src/consensus/tx_verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,14 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, const boo
// Size limits
if (::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) > MAX_LEGACY_BLOCK_SIZE)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize");
if (tx.vExtraPayload.size() > MAX_TX_EXTRA_PAYLOAD)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-payload-oversize");
// Different size for NFT
if (tx.nType == TRANSACTION_GROUP_CREATION_NFT) {
if (tx.vExtraPayload.size() > MAX_TX_EXTRA_NFT_PAYLOAD)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-nft-payload-oversize");
} else {
if (tx.vExtraPayload.size() > MAX_TX_EXTRA_PAYLOAD)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-payload-oversize");
}

// Check for negative or overflow output values
CAmount nValueOut = 0;
Expand Down
7 changes: 7 additions & 0 deletions src/tokens/rpctokenwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ static unsigned int ParseGroupAddrValue(const JSONRPCRequest& request,
outputs.push_back(recipient);
curparam += 2;
}
// If NFT then check if totalValue < desc.maxmint
if (tgCreation.creationTransaction->nType == TRANSACTION_GROUP_CREATION_NFT) {
CTokenGroupDescriptionNFT *tgDesc = boost::get<CTokenGroupDescriptionNFT>(tgCreation.pTokenGroupDescription.get());
if (totalValue != tgDesc->nMintAmount) {
throw JSONRPCError(RPC_TYPE_ERROR, strprintf("NFT mints the wrong amount (%d instead of %d)", totalValue, tgDesc->nMintAmount));
}
}
return curparam;
}

Expand Down

0 comments on commit 59a4007

Please sign in to comment.