Appends a single reissuance to the specified input if none exists, and the corresponding output in a shuffled position. Errors otherwise. Requires at least one output to exist (the fee output, which must be last).
| 2956 | // corresponding output in a shuffled position. Errors otherwise. Requires at |
| 2957 | // least one output to exist (the fee output, which must be last). |
| 2958 | void reissueasset_base(CMutableTransaction& mtx, size_t issuance_input_index, const CAmount asset_amount, const CTxDestination& asset_dest, const uint256& asset_blinder, const uint256& entropy) |
| 2959 | { |
| 2960 | CHECK_NONFATAL(mtx.vout.size() > 0); |
| 2961 | CHECK_NONFATAL(asset_amount > 0); |
| 2962 | CHECK_NONFATAL(mtx.vin[issuance_input_index].assetIssuance.IsNull()); |
| 2963 | |
| 2964 | CScript asset_script = GetScriptForDestination(asset_dest); |
| 2965 | |
| 2966 | CAsset asset; |
| 2967 | CalculateAsset(asset, entropy); |
| 2968 | |
| 2969 | mtx.vin[issuance_input_index].assetIssuance.assetEntropy = entropy; |
| 2970 | mtx.vin[issuance_input_index].assetIssuance.assetBlindingNonce = asset_blinder; |
| 2971 | mtx.vin[issuance_input_index].assetIssuance.nAmount = asset_amount; |
| 2972 | |
| 2973 | // Place assets into randomly placed output slots, before change output, inserted in place |
| 2974 | int asset_place = GetRandInt(mtx.vout.size()); |
| 2975 | |
| 2976 | CTxOut asset_out(asset, asset_amount, asset_script); |
| 2977 | // If blinded address, insert the pubkey into the nonce field for later substitution by blinding |
| 2978 | if (IsBlindDestination(asset_dest)) { |
| 2979 | CPubKey asset_blind = GetDestinationBlindingKey(asset_dest); |
| 2980 | asset_out.nNonce.vchCommitment = std::vector<unsigned char>(asset_blind.begin(), asset_blind.end()); |
| 2981 | } |
| 2982 | mtx.vout.insert(mtx.vout.begin()+asset_place, asset_out); |
| 2983 | mtx.vin[issuance_input_index].assetIssuance.nAmount = asset_amount; |
| 2984 | } |
| 2985 | |
| 2986 | static RPCHelpMan rawissueasset() |
| 2987 | { |
no test coverage detected