mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Helper functions to determine whether a PSBTOutput is blinded
This commit is contained in:
parent
ee28be3018
commit
33c694f822
2 changed files with 31 additions and 0 deletions
28
src/psbt.cpp
28
src/psbt.cpp
|
|
@ -395,6 +395,34 @@ void PSBTOutput::Merge(const PSBTOutput& output)
|
|||
if (redeem_script.empty() && !output.redeem_script.empty()) redeem_script = output.redeem_script;
|
||||
if (witness_script.empty() && !output.witness_script.empty()) witness_script = output.witness_script;
|
||||
}
|
||||
|
||||
bool PSBTOutput::IsBlinded() const
|
||||
{
|
||||
return m_blinding_pubkey.IsValid();
|
||||
}
|
||||
|
||||
bool PSBTOutput::IsPartiallyBlinded() const
|
||||
{
|
||||
return IsBlinded() && (!amount ||
|
||||
!m_value_commitment.IsNull() ||
|
||||
!m_asset_commitment.IsNull() ||
|
||||
m_asset.IsNull() ||
|
||||
!m_value_rangeproof.empty() ||
|
||||
!m_asset_surjection_proof.empty() ||
|
||||
m_ecdh_pubkey.IsValid());
|
||||
}
|
||||
|
||||
bool PSBTOutput::IsFullyBlinded() const
|
||||
{
|
||||
return IsBlinded() && !amount &&
|
||||
!m_value_commitment.IsNull() &&
|
||||
!m_asset_commitment.IsNull() &&
|
||||
m_asset.IsNull() &&
|
||||
!m_value_rangeproof.empty() &&
|
||||
!m_asset_surjection_proof.empty() &&
|
||||
m_ecdh_pubkey.IsValid();
|
||||
}
|
||||
|
||||
bool PSBTInputSigned(const PSBTInput& input)
|
||||
{
|
||||
return !input.final_script_sig.empty() || !input.final_script_witness.IsNull();
|
||||
|
|
|
|||
|
|
@ -924,6 +924,9 @@ struct PSBTOutput
|
|||
void FillSignatureData(SignatureData& sigdata) const;
|
||||
void FromSignatureData(const SignatureData& sigdata);
|
||||
void Merge(const PSBTOutput& output);
|
||||
bool IsBlinded() const; //! This output has a blinding pubkey and is or will be blinded.
|
||||
bool IsPartiallyBlinded() const; //! This output has some blinding information. This is not a good state to be in.
|
||||
bool IsFullyBlinded() const; //! This output has all of the blinding information and is actually blinded.
|
||||
PSBTOutput(uint32_t version) : m_psbt_version(version) {}
|
||||
|
||||
template <typename Stream>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue