Skip to content

Commit

Permalink
Merge branch 'master' into elements-22-rc4
Browse files Browse the repository at this point in the history
  • Loading branch information
psgreco committed Aug 18, 2022
2 parents 3e44c1f + 0be72f4 commit 48dd32a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 12 deletions.
2 changes: 1 addition & 1 deletion contrib/macdeploy/macdeployqtplus
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ ds['.']['icvp'] = icvp
ds['.']['vSrn'] = ('long', 1)

ds['Applications']['Iloc'] = (370, 156)
ds['Bitcoin-Qt.app']['Iloc'] = (128, 156)
ds['Elements-Qt.app']['Iloc'] = (128, 156)

ds.flush()
ds.close()
Expand Down
3 changes: 3 additions & 0 deletions src/blindpsbt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ BlindingStatus BlindPSBT(PartiallySignedTransaction& psbt, std::map<uint32_t, st
}
}
}
else {
input_asset_blinders.emplace_back();
}
}
}
}
Expand Down
28 changes: 19 additions & 9 deletions src/psbt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,26 @@ CMutableTransaction PartiallySignedTransaction::GetUnsignedTx(bool force_unblind
txin.nSequence = input.sequence.value_or(max_sequence);
txin.assetIssuance.assetBlindingNonce = input.m_issuance_blinding_nonce;
txin.assetIssuance.assetEntropy = input.m_issuance_asset_entropy;
if (input.m_issuance_value != std::nullopt && input.m_issuance_inflation_keys_amount != std::nullopt && force_unblinded) {
// If there is a commitment we should set the value to the commitment unless we are forcing unblinded.
// If we are forcing unblinded but there is no value, we just use the commitment.
if (input.m_issuance_value != std::nullopt && (input.m_issuance_value_commitment.IsNull() || force_unblinded)) {
txin.assetIssuance.nAmount.SetToAmount(*input.m_issuance_value);
txin.assetIssuance.nInflationKeys.SetToAmount(*input.m_issuance_inflation_keys_amount);
} else {
}
else if(!input.m_issuance_value_commitment.IsNull()) {
txin.assetIssuance.nAmount = input.m_issuance_value_commitment;
}
else {
txin.assetIssuance.nAmount.SetNull();
}
if (input.m_issuance_inflation_keys_amount != std::nullopt && (input.m_issuance_inflation_keys_commitment.IsNull() || force_unblinded)) {
txin.assetIssuance.nInflationKeys.SetToAmount(*input.m_issuance_value);
}
else if(!input.m_issuance_inflation_keys_commitment.IsNull()) {
txin.assetIssuance.nInflationKeys = input.m_issuance_inflation_keys_commitment;
}
else {
txin.assetIssuance.nInflationKeys.SetNull();
}
mtx.vin.push_back(txin);
}
for (const PSBTOutput& output : outputs) {
Expand Down Expand Up @@ -531,12 +544,9 @@ bool PSBTOutput::Merge(const PSBTOutput& output)
CTxOut PSBTOutput::GetTxOut() const
{
assert(script != std::nullopt);
if (!m_value_commitment.IsNull() && !m_asset_commitment.IsNull()) {
return CTxOut(m_asset_commitment, m_value_commitment, *script);
}
assert(amount != std::nullopt);
assert(!m_asset.IsNull());
return CTxOut(CConfidentialAsset(CAsset(m_asset)), CConfidentialValue(*amount), *script);
assert(amount != std::nullopt || !m_value_commitment.IsNull());
assert(!m_asset.IsNull() || !m_asset_commitment.IsNull());
return CTxOut(!m_asset_commitment.IsNull() ? m_asset_commitment : CAsset(m_asset), !m_value_commitment.IsNull() ? m_value_commitment : CConfidentialValue(*amount), *script);
}

bool PSBTOutput::IsBlinded() const
Expand Down
2 changes: 1 addition & 1 deletion src/qt/bitcoinamountfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class AmountSpinBox: public QAbstractSpinBox
currentSingleStep = 100000000; // a whole asset
}
}
val.second = val.second + steps * singleStep;
val.second = val.second + steps * currentSingleStep;
val.second = qMax(val.second, CAmount(0));
val.second = qBound(m_min_amount, val.second, m_max_amount);
// FIXME: Add this back in when assets can have > MAX_MONEY
Expand Down
2 changes: 1 addition & 1 deletion src/script/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3173,7 +3173,7 @@ static bool VerifyWitnessProgram(const CScriptWitness& witness, int witversion,
}
execdata.m_tapleaf_hash_init = true;
if ((control[0] & TAPROOT_LEAF_MASK) == TAPROOT_LEAF_TAPSCRIPT) {
// Tapscript (leaf version 0xc0)
// Tapscript (leaf version 0xc4)
execdata.m_validation_weight_left = ::GetSerializeSize(witness.stack, PROTOCOL_VERSION) + VALIDATION_WEIGHT_OFFSET;
execdata.m_validation_weight_left_init = true;
return ExecuteWitnessScript(stack, exec_script, flags, SigVersion::TAPSCRIPT, checker, execdata, serror);
Expand Down
4 changes: 4 additions & 0 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2048,11 +2048,15 @@ TransactionError CWallet::SignPSBT(PartiallySignedTransaction& psbtx, bool& comp
txin.assetIssuance.nAmount = input.m_issuance_value_commitment;
} else if (input.m_issuance_value) {
txin.assetIssuance.nAmount.SetToAmount(*input.m_issuance_value);
} else {
txin.assetIssuance.nAmount.SetNull();
}
if (!input.m_issuance_inflation_keys_commitment.IsNull()) {
txin.assetIssuance.nInflationKeys = input.m_issuance_inflation_keys_commitment;
} else if (input.m_issuance_inflation_keys_amount) {
txin.assetIssuance.nInflationKeys.SetToAmount(*input.m_issuance_inflation_keys_amount);
} else {
txin.assetIssuance.nInflationKeys.SetNull();
}
if (!input.m_issuance_rangeproof.empty()) {
txinwit.vchIssuanceAmountRangeproof = input.m_issuance_rangeproof;
Expand Down

0 comments on commit 48dd32a

Please sign in to comment.