QT: dummy address needs fully valid pubkey

This commit is contained in:
Gregory Sanders 2019-04-17 14:54:37 -04:00
parent c227c65a13
commit 93e26608c2

View file

@ -87,16 +87,15 @@ QFont fixedPitchFont()
#endif
}
// Just some dummy data to generate a convincing random-looking (but consistent) address
static const uint8_t dummydata[33] = {3};
// Generate a dummy address with invalid CRC, starting with the network prefix.
static std::string DummyAddress(const CChainParams &params)
{
std::vector<unsigned char> dummydata = ParseHex("02217226f8114ad5807e90402a534ff3311a44f498ce5c0f1f56ccd9e60383d01e");
std::vector<unsigned char> sourcedata;
CPubKey dummy_key(&dummydata[0], &dummydata[33]);
CPubKey dummy_key(dummydata);
ScriptHash script_dest(uint160(), dummy_key);
DecodeBase58(EncodeDestination(script_dest), sourcedata);
std::string dest_str = EncodeDestination(script_dest);
DecodeBase58(dest_str, sourcedata);
for(int i=0; i<256; ++i) { // Try every trailing byte
std::string s = EncodeBase58(sourcedata.data(), sourcedata.data() + sourcedata.size());
if (!IsValidDestinationString(s)) {