Skip to content

Commit

Permalink
Alias "blech32" to "bech32" for address creation
Browse files Browse the repository at this point in the history
This is technically not 100% correct since if blinded addresses are
turned off, it will create a normal address for "blech32".
But it's the simplest thing to do.
  • Loading branch information
stevenroose committed May 30, 2019
1 parent e1bf441 commit 825a0da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/outputtype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
static const std::string OUTPUT_TYPE_STRING_LEGACY = "legacy";
static const std::string OUTPUT_TYPE_STRING_P2SH_SEGWIT = "p2sh-segwit";
static const std::string OUTPUT_TYPE_STRING_BECH32 = "bech32";
static const std::string OUTPUT_TYPE_STRING_BLECH32 = "blech32";

bool ParseOutputType(const std::string& type, OutputType& output_type)
{
Expand All @@ -25,7 +26,7 @@ bool ParseOutputType(const std::string& type, OutputType& output_type)
} else if (type == OUTPUT_TYPE_STRING_P2SH_SEGWIT) {
output_type = OutputType::P2SH_SEGWIT;
return true;
} else if (type == OUTPUT_TYPE_STRING_BECH32) {
} else if (type == OUTPUT_TYPE_STRING_BECH32 || type == OUTPUT_TYPE_STRING_BLECH32) {
output_type = OutputType::BECH32;
return true;
}
Expand Down
6 changes: 6 additions & 0 deletions test/functional/feature_confidential_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ def run_test(self):
print("Testing wallet secret recovery")
self.test_wallet_recovery()

# Test that "blech32" gives a blinded segwit address.
blech32_addr = self.nodes[0].getnewaddress("", "blech32")
blech32_addr_info = self.nodes[0].getaddressinfo(blech32_addr)
assert_equal(blech32_addr_info["iswitness"], True)
assert_equal(blech32_addr_info["confidential"], blech32_addr)

print("General Confidential tests")
# Running balances
node0 = self.nodes[0].getbalance()["bitcoin"]
Expand Down

0 comments on commit 825a0da

Please sign in to comment.