From 756bdc060ef6dfa4ce61fde4601033d84aa2dd9d Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 12 Dec 2018 16:13:55 -0500 Subject: [PATCH] issueasset_base: Push 0-value value to issuance field if blinding --- src/rpc/rawtransaction.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index bf21a1f421..55cdfc4421 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -1635,10 +1635,13 @@ void issueasset_base(CMutableTransaction& mtx, IssuanceDetails& issuance_details CPubKey asset_blind = asset_address.GetBlindingKey(); asset_out.nNonce.vchCommitment = std::vector(asset_blind.begin(), asset_blind.end()); } - // Don't issue stuff or set values unless non-zero (both are against consensus) + // Explicit 0 is represented by a null value, don't set to non-null in that case + if (blind_issuance || asset_amount != 0) { + mtx.vin[issuance_input_index].assetIssuance.nAmount = asset_amount; + } + // Don't make zero value output(impossible by consensus) if (asset_amount > 0) { mtx.vout.insert(mtx.vout.begin()+asset_place, asset_out); - mtx.vin[issuance_input_index].assetIssuance.nAmount = asset_amount; } CTxOut token_out(token, token_amount, token_destination); @@ -1647,10 +1650,13 @@ void issueasset_base(CMutableTransaction& mtx, IssuanceDetails& issuance_details CPubKey token_blind = token_address.GetBlindingKey(); token_out.nNonce.vchCommitment = std::vector(token_blind.begin(), token_blind.end()); } - // Don't issue stuff or set values unless non-zero (both are against consensus) + // Explicit 0 is represented by a null value, don't set to non-null in that case + if (blind_issuance || token_amount != 0) { + mtx.vin[issuance_input_index].assetIssuance.nInflationKeys = token_amount; + } + // Don't make zero value output(impossible by consensus) if (token_amount > 0) { mtx.vout.insert(mtx.vout.begin()+token_place, token_out); - mtx.vin[issuance_input_index].assetIssuance.nInflationKeys = token_amount; } }