12#include <test/util/setup_common.h>
14#include <boost/test/unit_test.hpp>
47 dgb.addLevel(key,
l1key.GetPubKey());
86 "46116afa1abaab88b96c115c248b77c7d8e099565c5fb40731482c6655ca450d21"
87 "023beefdde700a6bc02036335b4df141c8bc67bb05a971f5ac2745fd683797dde3"
89 "afc74900c1f28b69e466461fb1e0663352da6153be0fcd59280e27f2446391d5",
90 "023beefdde700a6bc02036335b4df141c8bc67bb05a971f5ac2745fd683797dde3",
91 DelegationResult::NONE},
93 "46116afa1abaab88b96c115c248b77c7d8e099565c5fb40731482c6655ca450d21"
94 "023beefdde700a6bc02036335b4df141c8bc67bb05a971f5ac2745fd683797dde3"
95 "012103e49f9df52de2dea81cf7838b82521b69f2ea360f1c4eed9e6c89b7d0f9e645e"
97 "2ddbea7c88dcf38412b58374856a466e165797a69321c0928a89c64521f7e2e767c93"
98 "de645ef5125ec901dcd51347787ca29771e7786bbe402d2d5ead0dc",
99 "ffcd49dc98ebdbc90e731a7b0c89939bfe082f15f3aa82aca657176b83669185",
100 "03e49f9df52de2dea81cf7838b82521b69f2ea360f1c4eed9e6c89b7d0f9e645ef",
101 DelegationResult::NONE},
103 "46116afa1abaab88b96c115c248b77c7d8e099565c5fb40731482c6655ca450d21"
104 "023beefdde700a6bc02036335b4df141c8bc67bb05a971f5ac2745fd683797dde3"
105 "022103e49f9df52de2dea81cf7838b82521b69f2ea360f1c4eed9e6c89b7d0f9e645e"
106 "f7d512ddbea7c88dcf38412b58374856a466e165797a69321c0928a89c64521f7e2e7"
107 "67c93de645ef5125ec901dcd51347787ca29771e7786bbe402d2d5ead0dc2103aac52"
108 "f4cfca700e7e9824298e0184755112e32f359c832f5f6ad2ef62a2c024a5cddd0ffe8"
109 "4e12e4bf49e4c0af7c8548e618a24e12495d659f5ba75e114e1526a618aa305b1e69b"
110 "f6ae20b2557999f2e3fec25d5f2271f8b9de0d06ba7344550",
111 "a3f98e6b5ec330219493d109e5c11ed8e302315df4604b5462e9fb80cb0fde89",
112 "03aac52f4cfca700e7e9824298e0184755112e32f359c832f5f6ad2ef62a2c024a",
113 DelegationResult::NONE},
115 "46116afa1abaab88b96c115c248b77c7d8e099565c5fb40731482c6655ca450d21"
116 "023beefdde700a6bc02036335b4df141c8bc67bb05a971f5ac2745fd683797dde3012"
117 "103e49f9df53de2dea81cf7838b82521b69f2ea360f1c4eed9e6c89b7d0f9e645ef7d"
118 "512ddbea7c88dcf38412b58374856a466e165797a69321c0928a89c64521f7e2e767c"
119 "93de645ef5125ec901dcd51347787ca29771e7786bbe402d2d5ead0dc",
120 "af7e82716489c3cf3f361d449ed815112ff619f7fc34a4803bd958c68d1e2684",
121 "023beefdde700a6bc02036335b4df141c8bc67bb05a971f5ac2745fd683797dde3",
122 DelegationResult::INVALID_SIGNATURE},
123 {
"Invalid signature",
124 "46116afa1abaab88b96c115c248b77c7d8e099565c5fb40731482c6655ca450d21"
125 "023beefdde700a6bc02036335b4df141c8bc67bb05a971f5ac2745fd683797dde3"
126 "012103e49f9df52de2dea81cf7838b82521b69f2ea360f1c4eed9e6c89b7d0f9e645e"
127 "f7d512ddbea7c88dcf38412c58374856a466e165797a69321c0928a89c64521f7e2e7"
128 "67c93de645ef5125ec901dcd51347787ca29771e7786bbe402d2d5ead0dc",
129 "ffcd49dc98ebdbc90e731a7b0c89939bfe082f15f3aa82aca657176b83669185",
130 "023beefdde700a6bc02036335b4df141c8bc67bb05a971f5ac2745fd683797dde3",
131 DelegationResult::INVALID_SIGNATURE},
132 {
"Second invalid key",
133 "46116afa1abaab88b96c115c248b77c7d8e099565c5fb40731482c6655ca450d21"
134 "023beefdde700a6bc02036335b4df141c8bc67bb05a971f5ac2745fd683797dde3"
135 "022103e49f9df52de2dea81cf7838b82521b69f2ea360f1c4eed9e6c89b7d0f9e645e"
136 "f7d512ddbea7c88dcf38412b58374856a466e165797a69321c0928a89c64521f7e2e7"
137 "67c93de645ef5125ec901dcd51347787ca29771e7786bbe402d2d5ead0dc2103aac52"
138 "f4dfca700e7e9824298e0184755112e32f359c832f5f6ad2ef62a2c024a5cddd0ffe8"
139 "4e12e4bf49e4c0af7c8548e618a24e12495d659f5ba75e114e1526a618aa305b1e69b"
140 "f6ae20b2557999f2e3fec25d5f2271f8b9de0d06ba7344550",
141 "b474512f71a3f5a6e94cc3b958fd658ece0d0632ace58c8c8f9f65c2b9ad5fad",
142 "03e49f9df52de2dea81cf7838b82521b69f2ea360f1c4eed9e6c89b7d0f9e645ef",
143 DelegationResult::INVALID_SIGNATURE},
144 {
"Second invalid signature",
145 "46116afa1abaab88b96c115c248b77c7d8e099565c5fb40731482c6655ca450d21"
146 "023beefdde700a6bc02036335b4df141c8bc67bb05a971f5ac2745fd683797dde3"
147 "022103e49f9df52de2dea81cf7838b82521b69f2ea360f1c4eed9e6c89b7d0f9e645e"
148 "f7d512ddbea7c88dcf38412b58374856a466e165797a69321c0928a89c64521f7e2e7"
149 "67c93de645ef5125ec901dcd51347787ca29771e7786bbe402d2d5ead0dc2103aac52"
150 "f4cfca700e7e9824298e0184755112e32f359c832f5f6ad2ef62a2c024a5cddd0ffe8"
151 "4e12e4bf49e4c0af7c8548e618a24e12495d659f5ba75e114e1526a618aa305b1e69b"
152 "f6ae20b2557999f2e3fec25d5f2271f8b9de0d06ba7344551",
153 "a3f98e6b5ec330219493d109e5c11ed8e302315df4604b5462e9fb80cb0fde89",
154 "03e49f9df52de2dea81cf7838b82521b69f2ea360f1c4eed9e6c89b7d0f9e645ef",
155 DelegationResult::INVALID_SIGNATURE},
167 c.result == DelegationResult::NONE);
#define Assert(val)
Identity function.
An encapsulated secp256k1 private key.
static CKey MakeCompressedKey()
Produce a valid compressed key.
An encapsulated public key.
static bool FromHex(Delegation &dg, const std::string &dgHex, bilingual_str &errorOut)
BOOST_AUTO_TEST_CASE(verify_random)
static void CheckDelegation(const Delegation &dg, const ProofRef &p, const CPubKey &expected_pubkey)
bool error(const char *fmt, const Args &...args)
constexpr size_t MAX_DELEGATION_LEVELS
The maximum number of delegation levels we are willing to verify.
ProofRef buildRandomProof(Chainstate &active_chainstate, uint32_t score, int height, const CKey &masterKey)
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK(expr)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
std::vector< uint8_t > ParseHex(const char *psz)
static DelegationId fromHex(const std::string &str)