mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
pset: make sure combinepsbt doesn't crash when explicit values are missing
I accidentally dropped this check (and its test) in the previous commits. Restore both.
This commit is contained in:
parent
187c8094bb
commit
fec0b59112
2 changed files with 3 additions and 0 deletions
|
|
@ -138,6 +138,7 @@ CMutableTransaction PartiallySignedTransaction::GetUnsignedTx(bool force_unblind
|
|||
txout.scriptPubKey = *output.script;
|
||||
|
||||
bool exp_value = output.m_value_commitment.IsNull() || force_unblinded;
|
||||
exp_value = exp_value && output.amount != nullopt;
|
||||
if (!output.m_value_commitment.IsNull() && output.amount != nullopt) {
|
||||
exp_value = exp_value && !output.m_blind_value_proof.empty();
|
||||
exp_value = exp_value && !output.m_asset_commitment.IsNull();
|
||||
|
|
@ -151,6 +152,7 @@ CMutableTransaction PartiallySignedTransaction::GetUnsignedTx(bool force_unblind
|
|||
}
|
||||
|
||||
bool exp_asset = output.m_asset_commitment.IsNull() || force_unblinded;
|
||||
exp_asset = exp_asset && !output.m_asset.IsNull();
|
||||
if (!output.m_asset_commitment.IsNull() && !output.m_asset.IsNull()) {
|
||||
exp_asset = exp_asset && !output.m_blind_asset_proof.empty();
|
||||
exp_asset = exp_asset && !output.m_asset.IsNull();
|
||||
|
|
|
|||
|
|
@ -805,6 +805,7 @@ class PSBTTest(BitcoinTestFramework):
|
|||
assert_raises_rpc_error(-8, "PSBTs not compatible (different transactions)", self.nodes[0].combinepsbt, [BAD_VALUE_PROOF, BAD_ASSET_PROOF])
|
||||
for bad_pset in [ NO_VALUE_PROOF, BAD_VALUE_PROOF, NO_ASSET_PROOF, BAD_ASSET_PROOF ]:
|
||||
assert_raises_rpc_error(-8, "PSBTs not compatible (different transactions)", self.nodes[0].combinepsbt, [UNBLINDED, bad_pset])
|
||||
assert_raises_rpc_error(-8, "PSBTs not compatible (different transactions)", self.nodes[0].combinepsbt, [ONLY_BLIND, bad_pset])
|
||||
assert_raises_rpc_error(-8, "PSBTs not compatible (different transactions)", self.nodes[0].combinepsbt, [BLINDED, bad_pset])
|
||||
|
||||
def run_test(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue