diff --git a/src/assets/assets.cpp b/src/assets/assets.cpp index fe062ab0c4..ff0edc177a 100644 --- a/src/assets/assets.cpp +++ b/src/assets/assets.cpp @@ -927,30 +927,29 @@ bool CAssetsCache::TrySpendCoin(const COutPoint& out, const CTxOut& txOut) CAmount nAmount = -1; // Get the asset tx data - int nType = 0; + int nType = -1; bool fIsOwner = false; if (txOut.scriptPubKey.IsAssetScript(nType, fIsOwner)) { - txnouttype type = (txnouttype)nType; // Get the New Asset or Transfer Asset from the scriptPubKey - if (type == TX_NEW_ASSET && !fIsOwner) { + if (nType == TX_NEW_ASSET && !fIsOwner) { CNewAsset asset; if (AssetFromScript(txOut.scriptPubKey, asset, address)) { assetName = asset.strName; nAmount = asset.nAmount; } - } else if (type == TX_TRANSFER_ASSET) { + } else if (nType == TX_TRANSFER_ASSET) { CAssetTransfer transfer; if (TransferAssetFromScript(txOut.scriptPubKey, transfer, address)) { assetName = transfer.strName; nAmount = transfer.nAmount; } - } else if (type == TX_NEW_ASSET && fIsOwner) { + } else if (nType == TX_NEW_ASSET && fIsOwner) { if (!OwnerAssetFromScript(txOut.scriptPubKey, assetName, address)) return error("%s : ERROR Failed to get owner asset from the OutPoint: %s", __func__, out.ToString()); nAmount = OWNER_ASSET_AMOUNT; - } else if (type == TX_REISSUE_ASSET) { + } else if (nType == TX_REISSUE_ASSET) { CReissueAsset reissue; if (ReissueAssetFromScript(txOut.scriptPubKey, reissue, address)) { assetName = reissue.strName; @@ -1045,13 +1044,11 @@ bool CAssetsCache::UndoAssetCoin(const Coin& coin, const COutPoint& out) CAmount nAmount = 0; // Get the asset tx from the script - txnouttype type; - int nType = 0; + int nType = -1; bool fIsOwner = false; if(coin.out.scriptPubKey.IsAssetScript(nType, fIsOwner)) { - type = (txnouttype) nType; - if (type == TX_NEW_ASSET && !fIsOwner) { + if (nType == TX_NEW_ASSET && !fIsOwner) { CNewAsset asset; if (!AssetFromScript(coin.out.scriptPubKey, asset, strAddress)) { return error("%s : Failed to get asset from script while trying to undo asset spend. OutPoint : %s", @@ -1061,7 +1058,7 @@ bool CAssetsCache::UndoAssetCoin(const Coin& coin, const COutPoint& out) assetName = asset.strName; nAmount = asset.nAmount; - } else if (type == TX_TRANSFER_ASSET) { + } else if (nType == TX_TRANSFER_ASSET) { CAssetTransfer transfer; if (!TransferAssetFromScript(coin.out.scriptPubKey, transfer, strAddress)) return error( @@ -1071,7 +1068,7 @@ bool CAssetsCache::UndoAssetCoin(const Coin& coin, const COutPoint& out) assetName = transfer.strName; nAmount = transfer.nAmount; - } else if (type == TX_NEW_ASSET && fIsOwner) { + } else if (nType == TX_NEW_ASSET && fIsOwner) { std::string ownerName; if (!OwnerAssetFromScript(coin.out.scriptPubKey, ownerName, strAddress)) return error( @@ -1079,7 +1076,7 @@ bool CAssetsCache::UndoAssetCoin(const Coin& coin, const COutPoint& out) __func__, out.ToString()); assetName = ownerName; nAmount = OWNER_ASSET_AMOUNT; - } else if (type == TX_REISSUE_ASSET) { + } else if (nType == TX_REISSUE_ASSET) { CReissueAsset reissue; if (!ReissueAssetFromScript(coin.out.scriptPubKey, reissue, strAddress)) return error( @@ -1808,7 +1805,7 @@ bool IsScriptNewAsset(const CScript& scriptPubKey, int& nStartingIndex) int nType = 0; bool fIsOwner =false; if (scriptPubKey.IsAssetScript(nType, fIsOwner, nStartingIndex)) { - return (txnouttype)nType == TX_NEW_ASSET && !fIsOwner; + return nType == TX_NEW_ASSET && !fIsOwner; } return false; @@ -1851,7 +1848,7 @@ bool IsScriptOwnerAsset(const CScript& scriptPubKey, int& nStartingIndex) int nType = 0; bool fIsOwner =false; if (scriptPubKey.IsAssetScript(nType, fIsOwner, nStartingIndex)) { - return (txnouttype)nType == TX_NEW_ASSET && fIsOwner; + return nType == TX_NEW_ASSET && fIsOwner; } return false; @@ -1868,7 +1865,7 @@ bool IsScriptReissueAsset(const CScript& scriptPubKey, int& nStartingIndex) int nType = 0; bool fIsOwner =false; if (scriptPubKey.IsAssetScript(nType, fIsOwner, nStartingIndex)) { - return (txnouttype)nType == TX_REISSUE_ASSET; + return nType == TX_REISSUE_ASSET; } return false; @@ -1885,7 +1882,7 @@ bool IsScriptTransferAsset(const CScript& scriptPubKey, int& nStartingIndex) int nType = 0; bool fIsOwner =false; if (scriptPubKey.IsAssetScript(nType, fIsOwner, nStartingIndex)) { - return (txnouttype)nType == TX_TRANSFER_ASSET; + return nType == TX_TRANSFER_ASSET; } return false; diff --git a/src/coins.cpp b/src/coins.cpp index 19d8456b8f..5c46a97126 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -162,7 +162,7 @@ void AddCoins(CCoinsViewCache& cache, const CTransaction &tx, int nHeight, bool error("%s: Failed to add an reissued asset I own to my Unspent Asset Cache. Asset Name : %s", __func__, reissue.strName); } else if (tx.IsNewUniqueAsset()) { - for (int n = 0; n < tx.vout.size(); n++) { + for (int n = 0; n < (int)tx.vout.size(); n++) { auto out = tx.vout[n]; CNewAsset asset; diff --git a/src/consensus/tx_verify.cpp b/src/consensus/tx_verify.cpp index 9ce9559dc2..558aff2dc6 100644 --- a/src/consensus/tx_verify.cpp +++ b/src/consensus/tx_verify.cpp @@ -203,7 +203,7 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, CAssetsCa if (AreAssetsDeployed() && isAsset) { if (assetCache) { // Get the transfer transaction data from the scriptPubKey - if ((txnouttype) nType == TX_TRANSFER_ASSET) { + if ( nType == TX_TRANSFER_ASSET) { CAssetTransfer transfer; std::string address; if (!TransferAssetFromScript(txout.scriptPubKey, transfer, address)) diff --git a/src/qt/ravengui.cpp b/src/qt/ravengui.cpp index 56024e5adc..cc169db083 100644 --- a/src/qt/ravengui.cpp +++ b/src/qt/ravengui.cpp @@ -117,6 +117,7 @@ RavenGUI::RavenGUI(const PlatformStyle *_platformStyle, const NetworkStyle *netw openRPCConsoleAction(0), openAction(0), showHelpMessageAction(0), + assetAction(0), trayIcon(0), trayIconMenu(0), notificator(0), @@ -125,8 +126,8 @@ RavenGUI::RavenGUI(const PlatformStyle *_platformStyle, const NetworkStyle *netw modalOverlay(0), prevBlocks(0), spinnerFrame(0), - platformStyle(_platformStyle), - assetAction(0) + platformStyle(_platformStyle) + { QSettings settings; if (!restoreGeometry(settings.value("MainWindowGeometry").toByteArray())) { diff --git a/src/rpc/assets.cpp b/src/rpc/assets.cpp index 59ed9387ef..f865026ea8 100644 --- a/src/rpc/assets.cpp +++ b/src/rpc/assets.cpp @@ -300,7 +300,7 @@ UniValue issueunique(const JSONRPCRequest& request) } std::vector assets; - for (int i = 0; i < assetTags.size(); i++) { + for (int i = 0; i < (int)assetTags.size(); i++) { std::string tag = assetTags[i].get_str(); if (!IsUniqueTagValid(tag)) { diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 3640987017..b597305784 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -633,7 +633,7 @@ UniValue createrawtransaction(const JSONRPCRequest& request) rawTx.vout.push_back(out); // Create the assets - for (int i = 0; i < asset_tags.size(); i++) { + for (int i = 0; i < (int)asset_tags.size(); i++) { // Create a new asset CNewAsset asset; diff --git a/src/validation.cpp b/src/validation.cpp index 4a35a6e0b7..84877137ac 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1734,7 +1734,7 @@ static DisconnectResult DisconnectBlock(const CBlock& block, const CBlockIndex* } } } else if (tx.IsNewUniqueAsset()) { - for (int n = 0; n < tx.vout.size(); n++) { + for (int n = 0; n < (int)tx.vout.size(); n++) { auto out = tx.vout[n]; CNewAsset asset; std::string strAddress; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 8b912638f3..aeceb92349 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2291,22 +2291,22 @@ void CWallet::AvailableCoinsAll(std::vector& vCoins, std::maptx->vout[i].scriptPubKey.IsAssetScript(nType, fIsOwner)) { - if ((txnouttype) nType == TX_TRANSFER_ASSET) { + if ( nType == TX_TRANSFER_ASSET) { if (TransferAssetFromScript(pcoin->tx->vout[i].scriptPubKey, assetTransfer, address)) { strAssetName = assetTransfer.strName; fWasTransferAssetOutPoint = true; } - } else if ((txnouttype) nType == TX_NEW_ASSET && !fIsOwner) { + } else if ( nType == TX_NEW_ASSET && !fIsOwner) { if (AssetFromScript(pcoin->tx->vout[i].scriptPubKey, asset, address)) { strAssetName = asset.strName; fWasNewAssetOutPoint = true; } - } else if ((txnouttype) nType == TX_NEW_ASSET && fIsOwner) { + } else if ( nType == TX_NEW_ASSET && fIsOwner) { if (OwnerAssetFromScript(pcoin->tx->vout[i].scriptPubKey, ownerName, address)) { strAssetName = ownerName; fWasOwnerAssetOutPoint = true; } - } else if ((txnouttype) nType == TX_REISSUE_ASSET) { + } else if ( nType == TX_REISSUE_ASSET) { if (ReissueAssetFromScript(pcoin->tx->vout[i].scriptPubKey, reissue, address)) { strAssetName = reissue.strName; fWasReissueAssetOutPoint = true; @@ -2808,7 +2808,7 @@ bool CWallet::SelectAssetsMinConf(const CAmount& nTargetValue, const int nConfMi //------------------------------- - int nType = 0; + int nType = -1; bool fIsOwner = false; if (!coin.txout.scriptPubKey.IsAssetScript(nType, fIsOwner)) { // TODO - Remove std::cout this before mainnet release @@ -2816,28 +2816,26 @@ bool CWallet::SelectAssetsMinConf(const CAmount& nTargetValue, const int nConfMi continue; } - txnouttype type = (txnouttype) nType; - CAmount nTempAmount = 0; - if (type == TX_NEW_ASSET && !fIsOwner) { // Root/Sub Asset + if (nType == TX_NEW_ASSET && !fIsOwner) { // Root/Sub Asset CNewAsset assetTemp; std::string address; if (!AssetFromScript(coin.txout.scriptPubKey, assetTemp, address)) continue; nTempAmount = assetTemp.nAmount; - } else if (type == TX_TRANSFER_ASSET) { // Transfer Asset + } else if (nType == TX_TRANSFER_ASSET) { // Transfer Asset CAssetTransfer transferTemp; std::string address; if (!TransferAssetFromScript(coin.txout.scriptPubKey, transferTemp, address)) continue; nTempAmount = transferTemp.nAmount; - } else if (type == TX_NEW_ASSET && fIsOwner) { // Owner Asset + } else if (nType == TX_NEW_ASSET && fIsOwner) { // Owner Asset std::string ownerName; std::string address; if (!OwnerAssetFromScript(coin.txout.scriptPubKey, ownerName, address)) continue; nTempAmount = OWNER_ASSET_AMOUNT; - } else if (type == TX_REISSUE_ASSET) { // Reissue Asset + } else if (nType == TX_REISSUE_ASSET) { // Reissue Asset CReissueAsset reissueTemp; std::string address; if (!ReissueAssetFromScript(coin.txout.scriptPubKey, reissueTemp, address))