Skip to content

A couple miscellaneous fixes for fuzztests #1391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/primitives/confidential.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ class CConfidentialValue : public CConfidentialCommitment<9, 8, 9>
CConfidentialValue() { SetNull(); }
CConfidentialValue(CAmount nAmount) { SetToAmount(nAmount); }

template <typename Stream>
inline void Unserialize(Stream& s) {
CConfidentialCommitment::Unserialize(s);
}

/* An explicit value is called an amount. The first byte indicates it is
* an explicit value, and the remaining 8 bytes is the value serialized as
* a 64-bit big-endian integer. */
Expand Down
3 changes: 3 additions & 0 deletions src/primitives/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,9 @@ class CTxOut
s >> nAsset;
s >> nValue;
s >> nNonce;
if (nAsset.IsNull() || nValue.IsNull()) {
throw std::ios_base::failure("Confidential values may not be null");
}
} else {
CAmount value;
s >> value;
Expand Down
8 changes: 7 additions & 1 deletion src/test/fuzz/rbf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
#include <string>
#include <vector>

FUZZ_TARGET(rbf)
void initialize_rbf(void) {
// ELEMENTS: our mempool needs Params() to be set for multiple reasons -- to check
// the discount CT rate, to figure out pegin policy, etc
SelectParams(CBaseChainParams::LIQUID1);
}

FUZZ_TARGET_INIT(rbf, initialize_rbf)
{
FuzzedDataProvider fuzzed_data_provider(buffer.data(), buffer.size());
SetMockTime(ConsumeTime(fuzzed_data_provider));
Expand Down