Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pset: Tests and bug fixes for input explicit value and asset fields #1165

Merged
merged 4 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/psbt.h
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ struct PSBTInput
{
if (!key_lookup.emplace(key).second) {
throw std::ios_base::failure("Duplicate Key, explicit value is already provided");
} else if (key.size() != 1) {
} else if (subkey_len != 1) {
throw std::ios_base::failure("Input explicit value is more than one byte type");
}
CAmount v;
Expand All @@ -937,7 +937,7 @@ struct PSBTInput
{
if (!key_lookup.emplace(key).second) {
throw std::ios_base::failure("Duplicate Key, explicit value proof is already provided");
} else if (key.size() != 1) {
} else if (subkey_len != 1) {
throw std::ios_base::failure("Input explicit value proof is more than one byte type");
}
s >> m_value_proof;
Expand All @@ -947,7 +947,7 @@ struct PSBTInput
{
if (!key_lookup.emplace(key).second) {
throw std::ios_base::failure("Duplicate Key, explicit asset is already provided");
} else if (key.size() != 1) {
} else if (subkey_len != 1) {
throw std::ios_base::failure("Input explicit asset is more than one byte type");
}
UnserializeFromVector(s, m_explicit_asset);
Expand All @@ -957,17 +957,17 @@ struct PSBTInput
{
if (!key_lookup.emplace(key).second) {
throw std::ios_base::failure("Duplicate Key, explicit asset proof is already provided");
} else if (key.size() != 1) {
} else if (subkey_len != 1) {
throw std::ios_base::failure("Input explicit asset proof is more than one byte type");
}
s >> m_value_proof;
s >> m_asset_proof;
break;
}
case PSBT_ELEMENTS_IN_BLINDED_ISSUANCE:
{
if (!key_lookup.emplace(key).second) {
throw std::ios_base::failure("Duplicate Key, issuance needs blinded flag is already provided");
} else if (key.size() != 1) {
} else if (subkey_len != 1) {
throw std::ios_base::failure("Input issuance needs blinded flag is more than one byte type");
}
bool b;
Expand Down Expand Up @@ -1028,7 +1028,7 @@ struct PSBTInput
if ((m_explicit_value.has_value() || !m_value_proof.empty()) && (!m_explicit_value.has_value() || m_value_proof.empty())) {
throw std::ios_base::failure("Input explicit value and value proof must be provided together");
}
if ((!m_explicit_asset.IsNull() || !m_asset_proof.empty()) && (!m_explicit_asset.IsNull() || m_asset_proof.empty())) {
if ((!m_explicit_asset.IsNull() || !m_asset_proof.empty()) && (m_explicit_asset.IsNull() || m_asset_proof.empty())) {
throw std::ios_base::failure("Input explicit asset and asset proof must be provided together");
}
}
Expand Down
Loading