MCPcopy Create free account
hub / github.com/ElementsProject/elements / Decode

Method Decode

src/minisketch/src/sketch_impl.h:394–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392 }
393
394 int Decode(int max_count, uint64_t* out) const override
395 {
396 auto all_syndromes = ReconstructAllSyndromes(m_syndromes, m_field);
397 auto poly = BerlekampMassey(all_syndromes, max_count, m_field);
398 if (poly.size() == 0) return -1;
399 if (poly.size() == 1) return 0;
400 if ((int)poly.size() > 1 + max_count) return -1;
401 std::reverse(poly.begin(), poly.end());
402 auto roots = FindRoots(poly, m_basis, m_field);
403 if (roots.size() == 0) return -1;
404
405 for (const auto& root : roots) {
406 *(out++) = m_field.ToUint64(root);
407 }
408 return roots.size();
409 }
410
411 size_t Merge(const Sketch* other_sketch) override
412 {

Callers 8

walletdb.cppFile · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
FUZZ_TARGETFunction · 0.45
FUZZ_TARGETFunction · 0.45
TestExhaustiveFunction · 0.45
TestRandomizedFunction · 0.45
minisketch_decodeFunction · 0.45
FindBestImplementationFunction · 0.45

Calls 7

ReconstructAllSyndromesFunction · 0.85
BerlekampMasseyFunction · 0.85
FindRootsFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
ToUint64Method · 0.45

Tested by 5

BOOST_AUTO_TEST_CASEFunction · 0.36
FUZZ_TARGETFunction · 0.36
FUZZ_TARGETFunction · 0.36
TestExhaustiveFunction · 0.36
TestRandomizedFunction · 0.36