Skip to content

Commit ed31d22

Browse files
authored
Merge pull request #1165 from achow101/explicit-pset-fields-tests
pset: Tests and bug fixes for input explicit value and asset fields
2 parents 457a564 + 66290e6 commit ed31d22

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

src/psbt.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ struct PSBTInput
925925
{
926926
if (!key_lookup.emplace(key).second) {
927927
throw std::ios_base::failure("Duplicate Key, explicit value is already provided");
928-
} else if (key.size() != 1) {
928+
} else if (subkey_len != 1) {
929929
throw std::ios_base::failure("Input explicit value is more than one byte type");
930930
}
931931
CAmount v;
@@ -937,7 +937,7 @@ struct PSBTInput
937937
{
938938
if (!key_lookup.emplace(key).second) {
939939
throw std::ios_base::failure("Duplicate Key, explicit value proof is already provided");
940-
} else if (key.size() != 1) {
940+
} else if (subkey_len != 1) {
941941
throw std::ios_base::failure("Input explicit value proof is more than one byte type");
942942
}
943943
s >> m_value_proof;
@@ -947,7 +947,7 @@ struct PSBTInput
947947
{
948948
if (!key_lookup.emplace(key).second) {
949949
throw std::ios_base::failure("Duplicate Key, explicit asset is already provided");
950-
} else if (key.size() != 1) {
950+
} else if (subkey_len != 1) {
951951
throw std::ios_base::failure("Input explicit asset is more than one byte type");
952952
}
953953
UnserializeFromVector(s, m_explicit_asset);
@@ -957,17 +957,17 @@ struct PSBTInput
957957
{
958958
if (!key_lookup.emplace(key).second) {
959959
throw std::ios_base::failure("Duplicate Key, explicit asset proof is already provided");
960-
} else if (key.size() != 1) {
960+
} else if (subkey_len != 1) {
961961
throw std::ios_base::failure("Input explicit asset proof is more than one byte type");
962962
}
963-
s >> m_value_proof;
963+
s >> m_asset_proof;
964964
break;
965965
}
966966
case PSBT_ELEMENTS_IN_BLINDED_ISSUANCE:
967967
{
968968
if (!key_lookup.emplace(key).second) {
969969
throw std::ios_base::failure("Duplicate Key, issuance needs blinded flag is already provided");
970-
} else if (key.size() != 1) {
970+
} else if (subkey_len != 1) {
971971
throw std::ios_base::failure("Input issuance needs blinded flag is more than one byte type");
972972
}
973973
bool b;
@@ -1028,7 +1028,7 @@ struct PSBTInput
10281028
if ((m_explicit_value.has_value() || !m_value_proof.empty()) && (!m_explicit_value.has_value() || m_value_proof.empty())) {
10291029
throw std::ios_base::failure("Input explicit value and value proof must be provided together");
10301030
}
1031-
if ((!m_explicit_asset.IsNull() || !m_asset_proof.empty()) && (!m_explicit_asset.IsNull() || m_asset_proof.empty())) {
1031+
if ((!m_explicit_asset.IsNull() || !m_asset_proof.empty()) && (m_explicit_asset.IsNull() || m_asset_proof.empty())) {
10321032
throw std::ios_base::failure("Input explicit asset and asset proof must be provided together");
10331033
}
10341034
}

0 commit comments

Comments
 (0)