MCPcopy Create free account
hub / github.com/citp/BlockSci / encode

Function encode

src/scripts/bitcoin_segwit_addr.cpp:74–81  ·  view source on GitHub ↗

Encode a SegWit address. */

Source from the content-addressed store, hash-verified

72
73/** Encode a SegWit address. */
74std::string encode(const std::string& hrp, int witver, const segwit_data& witprog) {
75 segwit_data enc;
76 enc.push_back(static_cast<unsigned char>(witver));
77 convertbits<8, 5, true>(enc, witprog);
78 std::string ret = bech32::encode(hrp, enc);
79 if (decode(hrp, ret).first == -1) return "";
80 return ret;
81}
82
83std::string encode(const blocksci::ChainConfiguration &config, int witver, const segwit_data& witprog) {
84 segwit_data enc;

Callers

nothing calls this directly

Calls 1

decodeFunction · 0.70

Tested by

no test coverage detected