mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 19:53:27 +01:00
Remove op== on PSBTs; check compatibility in Merge
Remove the op== on PartiallySignedTransaction, which only checks that the CTransactions are equal. Instead, check this directly in Merge, and return false if the CTransactions are not equal (so the PSBTs cannot be merged.)
This commit is contained in:
@@ -16,8 +16,13 @@ bool PartiallySignedTransaction::IsNull() const
|
||||
return !tx && inputs.empty() && outputs.empty() && unknown.empty();
|
||||
}
|
||||
|
||||
void PartiallySignedTransaction::Merge(const PartiallySignedTransaction& psbt)
|
||||
bool PartiallySignedTransaction::Merge(const PartiallySignedTransaction& psbt)
|
||||
{
|
||||
// Prohibited to merge two PSBTs over different transactions
|
||||
if (tx->GetHash() != psbt.tx->GetHash()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < inputs.size(); ++i) {
|
||||
inputs[i].Merge(psbt.inputs[i]);
|
||||
}
|
||||
@@ -25,6 +30,8 @@ void PartiallySignedTransaction::Merge(const PartiallySignedTransaction& psbt)
|
||||
outputs[i].Merge(psbt.outputs[i]);
|
||||
}
|
||||
unknown.insert(psbt.unknown.begin(), psbt.unknown.end());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PartiallySignedTransaction::IsSane() const
|
||||
|
||||
Reference in New Issue
Block a user