Skip to content

Commit f1b445c

Browse files
committed
Reapply "Merge pull request ElementsProject#1391 from apoelstra/2025-02--misc-fuzz-fixes"
This reverts commit acbb8b5.
1 parent 58113a8 commit f1b445c

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/primitives/confidential.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ class CConfidentialValue : public CConfidentialCommitment<9, 8, 9>
135135
CConfidentialValue() { SetNull(); }
136136
CConfidentialValue(CAmount nAmount) { SetToAmount(nAmount); }
137137

138+
template <typename Stream>
139+
inline void Unserialize(Stream& s) {
140+
CConfidentialCommitment::Unserialize(s);
141+
}
142+
138143
/* An explicit value is called an amount. The first byte indicates it is
139144
* an explicit value, and the remaining 8 bytes is the value serialized as
140145
* a 64-bit big-endian integer. */

src/primitives/transaction.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ class CTxOut
295295
s >> nAsset;
296296
s >> nValue;
297297
s >> nNonce;
298+
if (nAsset.IsNull() || nValue.IsNull()) {
299+
throw std::ios_base::failure("Confidential values may not be null");
300+
}
298301
} else {
299302
CAmount value;
300303
s >> value;

src/test/fuzz/rbf.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
#include <string>
1616
#include <vector>
1717

18-
FUZZ_TARGET(rbf)
18+
void initialize_rbf(void) {
19+
// ELEMENTS: our mempool needs Params() to be set for multiple reasons -- to check
20+
// the discount CT rate, to figure out pegin policy, etc
21+
SelectParams(CBaseChainParams::LIQUID1);
22+
}
23+
24+
FUZZ_TARGET_INIT(rbf, initialize_rbf)
1925
{
2026
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
2127
SetMockTime(ConsumeTime(fuzzed_data_provider));

0 commit comments

Comments
 (0)