Merge pull request #1184 from gwillen/feature-fix-taproot-parse-blinding

Preserve blinding key when parsing taproot address.
This commit is contained in:
Pablo Greco 2022-10-15 13:44:31 -03:00 committed by GitHub
commit ae220b8545
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -323,6 +323,7 @@ CTxDestination DecodeDestination(const std::string& str, const CChainParams& par
static_assert(WITNESS_V1_TAPROOT_SIZE == WitnessV1Taproot::size());
WitnessV1Taproot tap;
std::copy(data.begin(), data.end(), tap.begin());
tap.blinding_pubkey = blinding_pubkey;
return tap;
}

View file

@ -398,5 +398,13 @@ class AddressTypeTest(BitcoinTestFramework):
info2 = self.nodes[0].getaddressinfo(self.nodes[0].getrawchangeaddress("blech32"))
assert(len(info2["confidential_key"]) > 0)
# taproot (segwit v1) address parsing test
# We will use a hardcoded placeholder for now, until we can have the test use the wallet to generate one.
# This functions as a regression test for #1181.
tap_addr = "el1pqwp9ze75659cn5ad0hw25nt2kv7j882gudn636hnh4qvjcmjh6jq5ca0d4cgl009m5rn5w0n3k2cqa3ths2qf7s8q6x2xplwgvlfhg0atxwjah9089tf"
info3 = self.nodes[0].getaddressinfo(tap_addr)
assert_equal(tap_addr, info3["address"])
assert(len(info3["confidential_key"]) > 0)
if __name__ == '__main__':
AddressTypeTest().main()