Use BECH32M for tr() desc, WitV1Taproot, and WitUnknown CTxDests
The tr() descriptor, WitnessV1Taproot CTxDestination, and WitnessUnknown CTxDestination are OutputType::BECH32M so they should report as such.
This commit is contained in:
1 parent
699dfcd8ad
commit
6dbe4d1072
2 files changed
+9
-7
No files matched your search
@@ -646,11 +646,13 @@ static std::optional<OutputType> OutputTypeFromDestination(const CTxDestination&
|
|||||||
return OutputType::LEGACY;
|
return OutputType::LEGACY;
|
||||||
}
|
}
|
||||||
if (std::holds_alternative<WitnessV0KeyHash>(dest) ||
|
if (std::holds_alternative<WitnessV0KeyHash>(dest) ||
|
||||||
std::holds_alternative<WitnessV0ScriptHash>(dest) ||
|
std::holds_alternative<WitnessV0ScriptHash>(dest)) {
|
||||||
std::holds_alternative<WitnessV1Taproot>(dest) ||
|
|
||||||
std::holds_alternative<WitnessUnknown>(dest)) {
|
|
||||||
return OutputType::BECH32;
|
return OutputType::BECH32;
|
||||||
}
|
}
|
||||||
|
if (std::holds_alternative<WitnessV1Taproot>(dest) ||
|
||||||
|
std::holds_alternative<WitnessUnknown>(dest)) {
|
||||||
|
return OutputType::BECH32M;
|
||||||
|
}
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,7 +876,7 @@ public:
|
|||||||
{
|
{
|
||||||
assert(m_subdescriptor_args.size() == m_depths.size());
|
assert(m_subdescriptor_args.size() == m_depths.size());
|
||||||
}
|
}
|
||||||
std::optional<OutputType> GetOutputType() const override { return OutputType::BECH32; }
|
std::optional<OutputType> GetOutputType() const override { return OutputType::BECH32M; }
|
||||||
bool IsSingleType() const final { return true; }
|
bool IsSingleType() const final { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ class WalletTaprootTest(BitcoinTestFramework):
|
|||||||
result = self.addr_gen.importdescriptors([{"desc": desc_pub, "active": True, "timestamp": "now"}])
|
result = self.addr_gen.importdescriptors([{"desc": desc_pub, "active": True, "timestamp": "now"}])
|
||||||
assert(result[0]['success'])
|
assert(result[0]['success'])
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
addr_g = self.addr_gen.getnewaddress(address_type='bech32')
|
addr_g = self.addr_gen.getnewaddress(address_type='bech32m')
|
||||||
if treefn is not None:
|
if treefn is not None:
|
||||||
addr_r = self.make_addr(treefn, keys, i)
|
addr_r = self.make_addr(treefn, keys, i)
|
||||||
assert_equal(addr_g, addr_r)
|
assert_equal(addr_g, addr_r)
|
||||||
@@ -259,7 +259,7 @@ class WalletTaprootTest(BitcoinTestFramework):
|
|||||||
result = self.rpc_online.importdescriptors([{"desc": desc_change, "active": True, "timestamp": "now", "internal": True}])
|
result = self.rpc_online.importdescriptors([{"desc": desc_change, "active": True, "timestamp": "now", "internal": True}])
|
||||||
assert(result[0]['success'])
|
assert(result[0]['success'])
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
addr_g = self.rpc_online.getnewaddress(address_type='bech32')
|
addr_g = self.rpc_online.getnewaddress(address_type='bech32m')
|
||||||
if treefn is not None:
|
if treefn is not None:
|
||||||
addr_r = self.make_addr(treefn, keys_pay, i)
|
addr_r = self.make_addr(treefn, keys_pay, i)
|
||||||
assert_equal(addr_g, addr_r)
|
assert_equal(addr_g, addr_r)
|
||||||
@@ -290,7 +290,7 @@ class WalletTaprootTest(BitcoinTestFramework):
|
|||||||
result = self.psbt_offline.importdescriptors([{"desc": desc_change, "active": True, "timestamp": "now", "internal": True}])
|
result = self.psbt_offline.importdescriptors([{"desc": desc_change, "active": True, "timestamp": "now", "internal": True}])
|
||||||
assert(result[0]['success'])
|
assert(result[0]['success'])
|
||||||
for i in range(4):
|
for i in range(4):
|
||||||
addr_g = self.psbt_online.getnewaddress(address_type='bech32')
|
addr_g = self.psbt_online.getnewaddress(address_type='bech32m')
|
||||||
if treefn is not None:
|
if treefn is not None:
|
||||||
addr_r = self.make_addr(treefn, keys_pay, i)
|
addr_r = self.make_addr(treefn, keys_pay, i)
|
||||||
assert_equal(addr_g, addr_r)
|
assert_equal(addr_g, addr_r)
|
||||||
|
|||||||
Reference in new issue
Block a user