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

Function DummyAddress

src/qt/guiutil.cpp:105–123  ·  view source on GitHub ↗

Generate a dummy address with invalid CRC, starting with the network prefix.

Source from the content-addressed store, hash-verified

103
104// Generate a dummy address with invalid CRC, starting with the network prefix.
105static std::string DummyAddress(const CChainParams &params)
106{
107 std::vector<unsigned char> dummydata = ParseHex("02217226f8114ad5807e90402a534ff3311a44f498ce5c0f1f56ccd9e60383d01e");
108 std::vector<unsigned char> sourcedata;
109 CPubKey dummy_key(dummydata);
110 ScriptHash script_dest(CScriptID(), dummy_key);
111 std::string dest_str = EncodeDestination(script_dest);
112 if (!DecodeBase58(dest_str, sourcedata, 21)) {
113 return "";
114 }
115 for(int i=0; i<256; ++i) { // Try every trailing byte
116 std::string s = EncodeBase58(sourcedata);
117 if (!IsValidDestinationString(s)) {
118 return s;
119 }
120 sourcedata[sourcedata.size()-1] += 1;
121 }
122 return "";
123}
124
125void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent)
126{

Callers 1

setupAddressWidgetFunction · 0.85

Calls 7

ParseHexFunction · 0.85
CScriptIDClass · 0.85
EncodeDestinationFunction · 0.85
DecodeBase58Function · 0.85
EncodeBase58Function · 0.85
IsValidDestinationStringFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected