diff options
author | Glenn Willen <gwillen@nerdnet.org> | 2019-01-29 22:51:56 -0800 |
---|---|---|
committer | Glenn Willen <gwillen@nerdnet.org> | 2019-02-11 14:08:04 -0800 |
commit | 78b9893d020e8b1351565f1adbf591cb32f6dc90 (patch) | |
tree | 599c5a1b8627fb1681b038d3b89aef07f3ea8663 /src/psbt.h | |
parent | bd0dbe8763fc3029cf96531c9ccaba280b939445 (diff) |
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.)
Diffstat (limited to 'src/psbt.h')
-rw-r--r-- | src/psbt.h | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/psbt.h b/src/psbt.h index ad6f003015..4b7ea4383a 100644 --- a/src/psbt.h +++ b/src/psbt.h @@ -384,22 +384,15 @@ struct PartiallySignedTransaction std::map<std::vector<unsigned char>, std::vector<unsigned char>> unknown; bool IsNull() const; - void Merge(const PartiallySignedTransaction& psbt); + + /** Merge psbt into this. The two psbts must have the same underlying CTransaction (i.e. the + * same actual Bitcoin transaction.) Returns true if the merge succeeded, false otherwise. */ + NODISCARD bool Merge(const PartiallySignedTransaction& psbt); bool IsSane() const; PartiallySignedTransaction() {} PartiallySignedTransaction(const PartiallySignedTransaction& psbt_in) : tx(psbt_in.tx), inputs(psbt_in.inputs), outputs(psbt_in.outputs), unknown(psbt_in.unknown) {} explicit PartiallySignedTransaction(const CMutableTransaction& tx); - // Only checks if they refer to the same transaction - friend bool operator==(const PartiallySignedTransaction& a, const PartiallySignedTransaction &b) - { - return a.tx->GetHash() == b.tx->GetHash(); - } - friend bool operator!=(const PartiallySignedTransaction& a, const PartiallySignedTransaction &b) - { - return !(a == b); - } - template <typename Stream> inline void Serialize(Stream& s) const { |