diff --git a/src/omnicore/errors.h b/src/omnicore/errors.h index 08fcfc55d904..62e3b410801e 100644 --- a/src/omnicore/errors.h +++ b/src/omnicore/errors.h @@ -343,7 +343,7 @@ inline std::string error_str(int ec) { ec_str = "Non-fungible tokens are not yet activated"; break; case PKT_ERROR_NFT -21: - ec_str = "Property %d is of type non-fungible"; + ec_str = "Property is of type non-fungible"; break; case PKT_ERROR_NFT -23: ec_str = "Type or version not permitted for property"; @@ -376,7 +376,7 @@ inline std::string error_str(int ec) { ec_str = "Sender has insufficient balance of property"; break; case PKT_ERROR_NFT -33: - ec_str = "Sender %s does not own the range being sent"; + ec_str = "Sender does not own the range being sent"; break; default: diff --git a/src/omnicore/tx.cpp b/src/omnicore/tx.cpp index deb01cce484e..3a463f8d5663 100644 --- a/src/omnicore/tx.cpp +++ b/src/omnicore/tx.cpp @@ -1491,16 +1491,33 @@ int CMPTransaction::logicMath_SendAll() continue; } - if (IsFeatureActivated(FEATURE_NONFUNGIBLE_ISSUER, block)) { - // do not transfer non-fungible tokens - if (isPropertyNonFungible(propertyId)) { - PrintToConsole("%s: property %d is non-fungible and will not be included in processing.\n", __func__, propertyId); - continue; - } - } - int64_t moneyAvailable = ptally->getMoney(propertyId, BALANCE); + int64_t moneyNft = 0; + if (moneyAvailable > 0) { + if (IsFeatureActivated(FEATURE_NONFUNGIBLE_ISSUER, block)) { + if (isPropertyNonFungible(propertyId)) { + std::vector > > rangeMap = pDbNFT->GetNonFungibleTokenRanges(propertyId); + + for (std::vector > >::iterator it = rangeMap.begin(); it!= rangeMap.end(); ++it) { + const std::pair >& entry = *it; + const std::string& address = entry.first; + const std::pair& range = entry.second; + + if (address != sender) { + continue; + } + + bool success = pDbNFT->MoveNonFungibleTokens(propertyId, range.first, range.second, sender, receiver); + int64_t amount = (range.second - range.first) + 1; + moneyNft += amount; + + PrintToLog("%s: moving %d nfts of property %d from %s to %s. success? %d\n", __func__, amount, propertyId, sender, receiver, success); + } + PrintToLog("%s: total %d nfts moved of %d expected\n", __func__, moneyNft, moneyAvailable); + } + } + ++numberOfPropertiesSent; assert(update_tally_map(sender, propertyId, -moneyAvailable, BALANCE)); assert(update_tally_map(receiver, propertyId, moneyAvailable, BALANCE)); @@ -2460,6 +2477,7 @@ int CMPTransaction::logicMath_RevokeTokens(CBlockIndex* pindex) return (PKT_ERROR_TOKENS -22); } + if (isPropertyNonFungible(property)) { PrintToLog("%s(): rejected: property %d is of type non-fungible\n", __func__, property); return (PKT_ERROR_NFT -21); @@ -2529,9 +2547,11 @@ int CMPTransaction::logicMath_ChangeIssuer(CBlockIndex* pindex) return (PKT_ERROR_TOKENS -22); } - if (isPropertyNonFungible(property)) { - PrintToLog("%s(): rejected: property %d is of type non-fungible\n", __func__, property); - return (PKT_ERROR_NFT -21); + if (!IsFeatureActivated(FEATURE_NONFUNGIBLE_ISSUER, block)) { + if (isPropertyNonFungible(property)) { + PrintToLog("%s(): rejected: property %d is of type non-fungible\n", __func__, property); + return (PKT_ERROR_NFT -21); + } } if (!IsPropertyIdValid(property)) {