Merge #640: Alias "blech32" to "bech32" for address creation

825a0da Alias "blech32" to "bech32" for address creation (Steven Roose)

Pull request description:

  Closes #631

Tree-SHA512: 7a372cb0c84466dea9654d743b478b64548d8178ef0d60e5b085efacdf592d46cc3b22abef102c430226dc2e96a86fe8c0ba2a014480ab3962c951b1cc95316c
This commit is contained in:
Gregory Sanders 2019-06-05 11:27:23 +02:00
commit d8247a4143
No known key found for this signature in database
GPG key ID: F3F68E2D86A48FDB
2 changed files with 8 additions and 1 deletions

View file

@ -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)
{
@ -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;
}

View file

@ -104,6 +104,12 @@ class CTTest (BitcoinTestFramework):
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"]