MCPcopy Create free account
hub / github.com/JeanLucPons/VanitySearch / outputAdd

Function outputAdd

main.cpp:201–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199// ------------------------------------------------------------------------------------------
200
201void outputAdd(string outputFile, int addrType, string addr, string pAddr, string pAddrHex) {
202
203 FILE *f = stdout;
204 bool needToClose = false;
205
206 if (outputFile.length() > 0) {
207 f = fopen(outputFile.c_str(), "a");
208 if (f == NULL) {
209 printf("Cannot open %s for writing\n", outputFile.c_str());
210 f = stdout;
211 } else {
212 needToClose = true;
213 }
214 }
215
216 fprintf(f, "\nPub Addr: %s\n", addr.c_str());
217
218
219 switch (addrType) {
220 case P2PKH:
221 fprintf(f, "Priv (WIF): p2pkh:%s\n", pAddr.c_str());
222 break;
223 case P2SH:
224 fprintf(f, "Priv (WIF): p2wpkh-p2sh:%s\n", pAddr.c_str());
225 break;
226 case BECH32:
227 fprintf(f, "Priv (WIF): p2wpkh:%s\n", pAddr.c_str());
228 break;
229 }
230 fprintf(f, "Priv (HEX): 0x%s\n", pAddrHex.c_str());
231
232 if (needToClose)
233 fclose(f);
234
235}
236
237// ------------------------------------------------------------------------------------------
238#define CHECK_ADDR() \

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected