Merge pull request #1391 from apoelstra/2025-02--misc-fuzz-fixes

A couple miscellaneous fixes for fuzztests
This commit is contained in:
Byron Hambly 2025-02-07 09:31:18 +02:00 committed by GitHub
commit 72a5e4117c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 1 deletions

View file

@ -135,6 +135,11 @@ public:
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. */

View file

@ -295,6 +295,9 @@ public:
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;

View file

@ -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));