This patch removes the need for the intermediary Base58 type CBitcoinAddress
, by providing {Encode
,Decode
,IsValid
}Destination
functions that directly operate on the conversion between std::string
s and CTxDestination
.
As a side, it also fixes a number of indentation issues, and removes probably several unnecessary implicit CTxDestination
<->CBitcoinAddress
conversions.
This change is far from complete. In follow-ups I’d like to:
- Split off the specific address and key encoding logic from base58.h, and move it to a address.h or so.
- Replace
CTxDestination
with a non-boost::variant
version (which can be more efficient asboost::variant
allocates everything on the heap, and remove the need forboost::get<...>
andIsValidDestination
calls everywhere). - Do the same for
CBitcoinSecret
,CBitcoinExtKey
, andCBitcoinExtPubKey
.
However, I’ve tried to keep this patch to be minimally invasive, but still enough to support non-Base58 addresses. Perhaps a smaller patch is possible to hack Bech32 support into CBitcoinAddress
, but I would consider that a move in the wrong direction.