30 if ((int64_t)tx.
nLockTime < ((int64_t)tx.
nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime))
32 for (
const auto& txin : tx.
vin) {
41 assert(prevHeights->size() == tx.
vin.size());
49 int64_t nMinTime = -1;
54 bool fEnforceBIP68 =
static_cast<uint32_t
>(tx.
nVersion) >= 2
60 return std::make_pair(nMinHeight, nMinTime);
63 for (
size_t txinIndex = 0; txinIndex < tx.
vin.size(); txinIndex++) {
64 const CTxIn& txin = tx.
vin[txinIndex];
71 (*prevHeights)[txinIndex] = 0;
75 int nCoinHeight = (*prevHeights)[txinIndex];
98 return std::make_pair(nMinHeight, nMinTime);
105 if (lockPair.first >= block.
nHeight || lockPair.second >= nBlockTime)
118 unsigned int nSigOps = 0;
119 for (
const auto& txin : tx.
vin)
121 nSigOps += txin.scriptSig.GetSigOpCount(
false);
123 for (
const auto& txout : tx.
vout)
125 nSigOps += txout.scriptPubKey.GetSigOpCount(
false);
135 unsigned int nSigOps = 0;
136 for (
unsigned int i = 0; i < tx.
vin.size(); i++)
141 if (prevout.scriptPubKey.IsPayToScriptHash())
158 for (
unsigned int i = 0; i < tx.
vin.size(); i++)
172 return state.
DoS(10,
false, REJECT_INVALID,
"bad-txns-vin-empty");
174 return state.
DoS(10,
false, REJECT_INVALID,
"bad-txns-vout-empty");
177 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-oversize");
181 std::set<std::string> setAssetTransferNames;
182 std::map<std::pair<std::string, std::string>,
int> mapNullDataTxCount;
183 std::set<std::string> setNullGlobalAssetChanges;
184 bool fContainsNewRestrictedAsset =
false;
185 bool fContainsRestrictedAssetReissue =
false;
186 bool fContainsNullAssetVerifierTx =
false;
187 int nCountAddTagOuts = 0;
188 for (
const auto& txout : tx.
vout)
190 if (txout.nValue < 0)
191 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-vout-negative");
192 if (txout.nValue > MAX_MONEY)
193 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-vout-toolarge");
194 nValueOut += txout.nValue;
196 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-txouttotal-toolarge");
200 if (txout.scriptPubKey.IsNullAsset()) {
203 std::string strError =
"";
205 if (txout.scriptPubKey.IsNullAssetTxDataScript()) {
207 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-null-asset-data-serialization");
210 return state.
DoS(100,
false, REJECT_INVALID, strError);
212 auto pair = std::make_pair(data.
asset_name, address);
213 if(!mapNullDataTxCount.count(pair)){
214 mapNullDataTxCount.insert(std::make_pair(pair, 0));
217 mapNullDataTxCount.at(pair)++;
219 if (mapNullDataTxCount.at(pair) > 1)
220 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-null-data-only-one-change-per-asset-address");
229 }
else if (txout.scriptPubKey.IsNullGlobalRestrictionAssetTxDataScript()) {
231 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-null-global-asset-data-serialization");
234 return state.
DoS(100,
false, REJECT_INVALID, strError);
236 if (setNullGlobalAssetChanges.count(data.
asset_name)) {
237 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-null-data-only-one-global-change-per-asset-name");
240 setNullGlobalAssetChanges.insert(data.
asset_name);
242 }
else if (txout.scriptPubKey.IsNullAssetVerifierTxDataScript()) {
245 return state.
DoS(100,
false, REJECT_INVALID, strError);
247 if (fContainsNullAssetVerifierTx)
248 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-null-data-only-one-verifier-per-tx");
250 fContainsNullAssetVerifierTx =
true;
256 bool isAsset =
false;
259 if (txout.scriptPubKey.IsAssetScript(nType, fIsOwner))
263 if (isAsset && txout.nValue != 0)
264 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-asset-tx-amount-isn't-zero");
273 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-transfer-asset-bad-deserialize");
276 setAssetTransferNames.insert(transfer.
strName);
281 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-transfer-asset-name-invalid");
287 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-transfer-owner-amount-was-not-1");
293 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-transfer-unique-amount-was-not-1");
304 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-transfer-qualifier-amount-must be between 1 - 100");
311 if (nCountAddTagOuts) {
313 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-tx-doesn't-contain-required-burn-fee-for-adding-tags");
316 for (
auto entry: mapNullDataTxCount) {
318 std::string ownerToken = entry.first.first.substr(1, entry.first.first.size());
319 if (!setAssetTransferNames.count(ownerToken +
OWNER_TAG)) {
320 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-tx-contains-restricted-asset-null-tx-without-asset-transfer");
323 if (!setAssetTransferNames.count(entry.first.first)) {
324 return state.
DoS(100,
false, REJECT_INVALID,
325 "bad-txns-tx-contains-qualifier-asset-null-tx-without-asset-transfer");
330 for (
auto name: setNullGlobalAssetChanges) {
331 std::string rootName = name.substr(1, name.size());
332 if (!setAssetTransferNames.count(rootName +
OWNER_TAG)) {
333 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-tx-contains-global-asset-null-tx-without-asset-transfer");
340 if (fCheckDuplicateInputs) {
341 std::set<COutPoint> vInOutPoints;
342 for (
const auto& txin : tx.
vin)
344 if (!vInOutPoints.insert(txin.prevout).second)
345 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-inputs-duplicate");
351 if (tx.
vin[0].scriptSig.size() < 2 || tx.
vin[0].scriptSig.size() > 100)
352 return state.
DoS(100,
false, REJECT_INVALID,
"bad-cb-length");
356 for (
const auto& txin : tx.
vin)
357 if (txin.prevout.IsNull())
358 return state.
DoS(10,
false, REJECT_INVALID,
"bad-txns-prevout-null");
364 std::string strError =
"";
366 return state.
DoS(100,
false, REJECT_INVALID, strError);
369 std::string strAddress;
371 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-asset-from-transaction");
375 return state.
DoS(100,
false, REJECT_INVALID, strError);
378 return state.
DoS(100,
false, REJECT_INVALID, strError);
383 std::string strError;
385 return state.
DoS(100,
false, REJECT_INVALID, strError);
388 std::string strAddress;
390 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-reissue-asset");
393 return state.
DoS(100,
false, REJECT_INVALID, strError);
402 bool fNotFound =
false;
408 return state.
DoS(100,
false, REJECT_INVALID,
409 "bad-txns-reissue-restricted-verifier-" + strError);
413 fContainsRestrictedAssetReissue =
true;
419 std::string strError =
"";
421 return state.
DoS(100,
false, REJECT_INVALID, strError);
425 for (
auto out : tx.
vout)
430 std::string strAddress;
432 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-check-transaction-issue-unique-asset-serialization");
435 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-unique" + strError);
440 std::string strError =
"";
442 return state.
DoS(100,
false, REJECT_INVALID, strError);
445 std::string strAddress;
447 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-msgchannel-from-transaction");
450 return state.
DoS(100,
error(
"%s: %s", __func__, strError), REJECT_INVALID,
"bad-txns-issue-msgchannel" + strError);
454 std::string strError =
"";
456 return state.
DoS(100,
false, REJECT_INVALID, strError);
459 std::string strAddress;
461 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-qualifier-from-transaction");
464 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-qualfier" + strError);
468 std::string strError =
"";
470 return state.
DoS(100,
false, REJECT_INVALID, strError);
474 std::string strAddress;
476 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-restricted-from-transaction");
479 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-restricted" + strError);
484 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-restricted-verifier-search-" + strError);
487 fContainsNewRestrictedAsset =
true;
492 for (
auto out : tx.
vout) {
495 if (out.scriptPubKey.IsAssetScript(nType, _isOwner)) {
497 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-bad-asset-transaction");
502 return state.
DoS(100,
false, REJECT_INVALID,
503 "bad-txns-op-rvn-asset-not-in-right-script-location");
511 if (fContainsNullAssetVerifierTx && !fContainsRestrictedAssetReissue && !fContainsNewRestrictedAsset)
512 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-tx-cointains-verifier-string-without-restricted-asset-issuance-or-reissuance");
515 if (fContainsNewRestrictedAsset && !fContainsNullAssetVerifierTx) {
516 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-tx-cointains-restricted-asset-issuance-without-verifier");
529 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-inputs-missingorspent",
false,
530 strprintf(
"%s: inputs missing/spent", __func__));
534 for (
unsigned int i = 0; i < tx.
vin.size(); ++i) {
542 REJECT_INVALID,
"bad-txns-premature-spend-of-coinbase",
543 strprintf(
"tried to spend coinbase at depth %d", nSpendHeight - coin.
nHeight));
549 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-inputvalues-outofrange");
554 if (nValueIn < value_out) {
555 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-in-belowout",
false,
560 const CAmount txfee_aux = nValueIn - value_out;
562 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-fee-out-of-range");
574 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-inputs-missing-or-spent",
false,
575 strprintf(
"%s: inputs missing/spent", __func__));
579 std::map<std::string, CAmount> totalInputs;
581 std::map<std::string, std::string> mapAddresses;
583 for (
unsigned int i = 0; i < tx.
vin.size(); ++i) {
591 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-failed-to-get-asset-from-script");
605 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-restricted-asset-transfer-from-frozen-address");
612 std::map<std::string, CAmount> totalOutputs;
614 int64_t currentTime =
GetTime();
615 std::string strError =
"";
617 for (
const auto& txout : tx.
vout) {
619 bool fIsAsset =
false;
621 bool fIsOwner =
false;
622 if (txout.scriptPubKey.IsAssetScript(nType, fIsOwner))
627 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-is-asset-and-asset-not-active");
629 if (txout.scriptPubKey.IsNullAsset()) {
631 return state.
DoS(100,
false, REJECT_INVALID,
632 "bad-tx-null-asset-data-before-restricted-assets-activated");
634 if (txout.scriptPubKey.IsNullAssetTxDataScript()) {
636 return state.
DoS(100,
false, REJECT_INVALID, strError);
637 }
else if (txout.scriptPubKey.IsNullGlobalRestrictionAssetTxDataScript()) {
639 return state.
DoS(100,
false, REJECT_INVALID, strError);
640 }
else if (txout.scriptPubKey.IsNullAssetVerifierTxDataScript()) {
642 return state.
DoS(100,
false, REJECT_INVALID, strError);
644 return state.
DoS(100,
false, REJECT_INVALID,
"bad-tx-null-asset-data-unknown-type");
651 std::string address =
"";
653 return state.
DoS(100,
false, REJECT_INVALID,
"bad-tx-asset-transfer-bad-deserialize");
656 return state.
DoS(100,
false, REJECT_INVALID, strError);
659 if (totalOutputs.count(transfer.
strName))
662 totalOutputs.insert(make_pair(transfer.
strName, transfer.
nAmount));
664 if (!fRunningUnitTests) {
667 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-transfer-owner-amount-was-not-1");
672 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-transfer-asset-not-exist");
675 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-asset-database-corrupted");
678 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-transfer-asset-amount-not-match-units");
686 if (!transfer.
message.empty()) {
688 if (mapAddresses.count(transfer.
strName)) {
689 if (mapAddresses.at(transfer.
strName) == address) {
693 setMessages->insert(message);
694 LogPrintf(
"Got message: %s\n", message.ToString());
705 return state.
DoS(100,
false, REJECT_INVALID,
"bad-tx-asset-reissue-bad-deserialize");
709 return state.
DoS(100,
false, REJECT_INVALID,
"bad-tx-reissue-chaining-not-allowed");
711 vPairReissueAssets.emplace_back(std::make_pair(reissue.
strName, tx.
GetHash()));
723 error(
"%s : Failed to get new asset from transaction: %s", __func__, tx.
GetHash().
GetHex());
724 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-serialzation-failed");
733 bool fOwnerOutFound =
false;
734 for (
auto out : tx.
vout) {
736 std::string transferAddress;
739 fOwnerOutFound =
true;
745 if (!fOwnerOutFound) {
746 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-new-asset-missing-owner-asset");
752 return state.
DoS(100,
false, REJECT_INVALID, strError);
757 error(
"%s : Failed to get new asset from transaction: %s", __func__, tx.
GetHash().
GetHex());
758 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-reissue-serialzation-failed");
761 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-reissue-contextual-" + strError);
764 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-unique-contextual-" + strError);
767 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-msgchannel-before-messaging-is-active");
770 std::string strAddress;
772 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-msgchannel-serialzation-failed");
775 return state.
DoS(100,
error(
"%s: %s", __func__, strError), REJECT_INVALID,
776 "bad-txns-issue-msgchannel-contextual-" + strError);
779 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-qualifier-before-it-is-active");
782 std::string strAddress;
784 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-qualifier-serialzation-failed");
787 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-qualfier-contextual" + strError);
791 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-restricted-before-it-is-active");
795 std::string strAddress;
797 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-restricted-serialzation-failed");
800 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-restricted-contextual" + strError);
805 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-issue-restricted-verifier-search-" + strError);
809 return state.
DoS(100,
false, REJECT_INVALID, strError);
812 for (
auto out : tx.
vout) {
815 if (out.scriptPubKey.IsAssetScript(nType, _isOwner)) {
817 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-bad-asset-transaction");
823 return state.
DoS(100,
false, REJECT_INVALID,
824 "bad-txns-op-rvn-asset-not-in-right-script-location");
827 return state.
DoS(100,
false, REJECT_INVALID,
"bad-txns-bad-asset-script");
835 for (
const auto& outValue : totalOutputs) {
836 if (!totalInputs.count(outValue.first)) {
837 std::string errorMsg;
838 errorMsg =
strprintf(
"Bad Transaction - Trying to create outpoint for asset that you don't have: %s", outValue.first);
839 return state.
DoS(100,
false, REJECT_INVALID,
"bad-tx-inputs-outputs-mismatch " + errorMsg);
842 if (totalInputs.at(outValue.first) != outValue.second) {
843 std::string errorMsg;
844 errorMsg =
strprintf(
"Bad Transaction - Assets would be burnt %s", outValue.first);
845 return state.
DoS(100,
false, REJECT_INVALID,
"bad-tx-inputs-outputs-mismatch " + errorMsg);
850 if (totalOutputs.size() != totalInputs.size()) {
851 return state.
DoS(100,
false, REJECT_INVALID,
"bad-tx-asset-inputs-size-does-not-match-outputs-size");
bool QualifierAssetFromTransaction(const CTransaction &tx, CNewAsset &asset, std::string &strAddress)
unsigned int GetSigOpCount(bool fAccurate) const
Pre-version-0.6, Raven always counted CHECKMULTISIGs as 20 sigops.
#define OWNER_ASSET_AMOUNT
#define UNIQUE_ASSET_AMOUNT
bool CheckAddingTagBurnFee(const int &count) const
bool IsNewOwnerTxValid(const CTransaction &tx, const std::string &assetName, const std::string &address, std::string &errorMsg)
std::pair< int, int64_t > CalculateSequenceLocks(const CTransaction &tx, int flags, std::vector< int > *prevHeights, const CBlockIndex &block)
Calculates the block height and previous block's median time past at which the transaction will be co...
CBlockIndex * pprev
pointer to the index of the predecessor of this block
const Coin & AccessCoin(const COutPoint &output) const
Return a reference to Coin in the cache, or a pruned one if not found.
bool IsNewRestrictedAsset() const
Make sure to call VerifyNewAsset if this call returns true.
bool ContextualCheckReissueAsset(CAssetsCache *assetCache, const CReissueAsset &reissue_asset, std::string &strError, const CTransaction &tx)
bool SequenceLocks(const CTransaction &tx, int flags, std::vector< int > *prevHeights, const CBlockIndex &block)
Check if transaction is final per BIP 68 sequence numbers and can be included in a block...
unsigned int GetMaxBlockWeight()
size_t CountWitnessSigOps(const CScript &scriptSig, const CScript &scriptPubKey, const CScriptWitness *witness, unsigned int flags)
size_t GetSerializeSize(const T &t, int nType, int nVersion=0)
static const uint32_t SEQUENCE_FINAL
Only serialized through CTransaction.
bool AssetFromScript(const CScript &scriptPubKey, CNewAsset &assetNew, std::string &strAddress)
bool MoneyRange(const CAmount &nValue)
bool TransferAssetFromScript(const CScript &scriptPubKey, CAssetTransfer &assetTransfer, std::string &strAddress)
Get specific asset type metadata from the given scripts.
static const uint32_t SEQUENCE_LOCKTIME_DISABLE_FLAG
CTxOut out
unspent transaction output
bool AssetFromTransaction(const CTransaction &tx, CNewAsset &asset, std::string &strAddress)
These types of asset tx, have specific metadata at certain indexes in the transaction.
static const int SEQUENCE_LOCKTIME_GRANULARITY
bool VerifyNewUniqueAsset(std::string &strError) const
Call this function after IsNewUniqueAsset.
bool DoS(int level, bool ret=false, unsigned int chRejectCodeIn=0, const std::string &strRejectReasonIn="", bool corruptionIn=false, const std::string &strDebugMessageIn="")
bool AssetNullDataFromScript(const CScript &scriptPubKey, CNullAssetTxData &assetData, std::string &strAddress)
bool ReissueAssetFromScript(const CScript &scriptPubKey, CReissueAsset &reissue, std::string &strAddress)
bool HaveInputs(const CTransaction &tx) const
Check whether all prevouts of the transaction are present in the UTXO set represented by this view...
bool IsNewQualifierAsset() const
Make sure to call VerifyNewQualifierAsset if this call returns true.
bool IsNewAsset() const
RVN START.
#define QUALIFIER_ASSET_MAX_AMOUNT
const std::vector< CTxIn > vin
CAmount GetValueOut() const
bool GetAssetData(const CScript &script, CAssetOutputEntry &data)
bool IsAssetNameAnMsgChannel(const std::string &name)
Check if an asset is a message channel.
int64_t CAmount
Amount in corbies (Can be negative)
uint32_t nHeight
at which height this containing transaction was included in the active block chain ...
bool AreMessagingDeployed()
bool GlobalAssetNullDataFromScript(const CScript &scriptPubKey, CNullAssetTxData &assetData)
bool IsAssetNameValid(const std::string &name, AssetType &assetType, std::string &error)
bool ContextualCheckVerifierAssetTxOut(const CTxOut &txout, CAssetsCache *assetCache, std::string &strError)
bool AreAssetsDeployed()
RVN START.
bool VerifyNewQualfierAsset(std::string &strError) const
To be called on CTransactions where IsNewQualifierAsset returns true.
UniValue transfer(const JSONRPCRequest &request)
bool VerifyNullAssetDataFlag(const int &flag, std::string &strError)
Helper methods that validate changes to null asset data transaction databases.
bool GetAssetMetaDataIfExists(const std::string &name, CNewAsset &asset)
Returns true if an asset with the name exists, and it was able to get the asset metadata from databas...
An input of a transaction.
bool MsgChannelAssetFromTransaction(const CTransaction &tx, CNewAsset &asset, std::string &strAddress)
bool CheckTxInputs(const CTransaction &tx, CValidationState &state, const CCoinsViewCache &inputs, int nSpendHeight, CAmount &txfee)
Check whether all inputs of this transaction are valid (no double spends and amounts) This does not m...
bool ContextualCheckNewAsset(CAssetsCache *assetCache, const CNewAsset &asset, std::string &strError, bool fCheckMempool)
const uint256 & GetHash() const
bool ContextualCheckNullAssetTxOut(const CTxOut &txout, CAssetsCache *assetCache, std::string &strError)
std::map< std::string, uint256 > mapReissuedAssets
const std::vector< CTxOut > vout
bool EvaluateSequenceLocks(const CBlockIndex &block, std::pair< int, int64_t > lockPair)
bool ContextualCheckGlobalAssetTxOut(const CTxOut &txout, CAssetsCache *assetCache, std::string &strError)
An output of a transaction.
static const uint32_t SEQUENCE_LOCKTIME_TYPE_FLAG
An outpoint - a combination of a transaction hash and an index n into its vout.
bool GetVerifierStringFromTx(CNullAssetTxVerifierString &verifier, std::string &strError) const
std::string FormatMoney(const CAmount &n)
Money parsing/formatting utilities.
int64_t GetMedianTimePast() const
bool RestrictedAssetFromTransaction(const CTransaction &tx, CNewAsset &asset, std::string &strAddress)
bool AreRestrictedAssetsDeployed()
std::string EncodeDestination(const CTxDestination &dest)
static const uint32_t SEQUENCE_LOCKTIME_MASK
unsigned int GetLegacySigOpCount(const CTransaction &tx)
Auxiliary functions for transaction validation (ideally should not be exposed)
bool ReissueAssetFromTransaction(const CTransaction &tx, CReissueAsset &reissue, std::string &strAddress)
The block chain is a tree shaped structure starting with the genesis block at the root...
bool IsNewMsgChannelAsset() const
Make sure to call VerifyNewUniqueAsset if this call returns true.
bool CheckAmountWithUnits(const CAmount &nAmount, const int8_t nUnits)
Checks the amount and units, and makes sure that the amount uses the correct decimals.
std::string GetParentName(const std::string &name)
Get the root name of an asset.
unsigned int GetP2SHSigOpCount(const CTransaction &tx, const CCoinsViewCache &inputs)
Count ECDSA signature operations in pay-to-script-hash inputs.
std::string verifier_string
bool ContextualCheckVerifierString(CAssetsCache *cache, const std::string &verifier, const std::string &check_address, std::string &strError, bool fWithTags)
std::string GetHex() const
bool VerifyNewMsgChannelAsset(std::string &strError) const
To be called on CTransactions where IsNewAsset returns true.
bool IsAssetNameAQualifier(const std::string &name)
Check if an asset is a qualifier asset or sub qualifier.
bool ContextualCheckTransferAsset(CAssetsCache *assetCache, const CAssetTransfer &transfer, const std::string &address, std::string &strError)
bool VerifyReissueAsset(std::string &strError) const
To be called on CTransactions where IsReissueAsset returns true.
bool error(const char *fmt, const Args &... args)
bool CheckTransaction(const CTransaction &tx, CValidationState &state, bool fCheckDuplicateInputs)
Transaction validation functions.
bool CheckVerifierAssetTxOut(const CTxOut &txout, std::string &strError)
bool CheckTxAssets(const CTransaction &tx, CValidationState &state, const CCoinsViewCache &inputs, CAssetsCache *assetCache, bool fCheckMempool, std::vector< std::pair< std::string, uint256 > > &vPairReissueAssets, const bool fRunningUnitTests=false, std::set< CMessage > *setMessages=nullptr, int64_t nBlocktime=0)
RVN START.
bool CheckReissueAsset(const CReissueAsset &asset, std::string &strError)
bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
Check if transaction is final and can be included in a block with the specified height and time...
bool IsReissueAsset() const
int64_t GetTime()
GetTimeMicros() and GetTimeMillis() both return the system time, but in different units...
bool CheckForAddressRestriction(const std::string &restricted_name, const std::string &address, bool fSkipTempCache=false)
Return true if the address is marked as frozen.
The basic transaction that is broadcasted on the network and contained in blocks. ...
int nHeight
height of the entry in the chain. The genesis block has height 0
bool VerifyNewRestrictedAsset(std::string &strError) const
To be called on CTransactions where IsNewRestrictedAsset returns true.
CCoinsView that adds a memory cache for transactions to another CCoinsView.
CBlockIndex * GetAncestor(int height)
Efficiently find an ancestor of this block.
bool Invalid(bool ret=false, unsigned int _chRejectCode=0, const std::string &_strRejectReason="", const std::string &_strDebugMessage="")
CTxDestination destination
bool IsNewUniqueAsset() const
Make sure to call VerifyNewUniqueAsset if this call returns true.
bool VerifyNewAsset(std::string &strError) const
To be called on CTransactions where IsNewAsset returns true.
int64_t GetTransactionSigOpCost(const CTransaction &tx, const CCoinsViewCache &inputs, int flags)
Compute total signature operation cost of a transaction.
#define QUALIFIER_ASSET_MIN_AMOUNT
bool ContextualCheckUniqueAssetTx(CAssetsCache *assetCache, std::string &strError, const CTransaction &tx)
UniValue reissue(const JSONRPCRequest &request)
bool IsAssetNameAnRestricted(const std::string &name)
Check if an asset is a restricted asset.
bool IsAssetNameAnOwner(const std::string &name)
Check if an asset is an owner.
bool IsScriptNewUniqueAsset(const CScript &scriptPubKey)
Check script and see if it matches the unquie issuance template.
bool CheckNewAsset(const CNewAsset &asset, std::string &strError)