mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-18 22:35:39 +01:00
Merge bitcoin/bitcoin#22364: wallet: Make a tr() descriptor by default
4868c9f1b3Extract Taproot internal keyid with GetKeyFromDestination (Andrew Chow)d8abbe119cMention bech32m in -addresstype and -changetype help (Andrew Chow)8fb57845eeCreate a tr() descriptor bech32m DescriptorScriptPubKeyMan by default (Andrew Chow)54b3699862Store pubkeys in TRDescriptor::MakeScripts (Andrew Chow) Pull request description: Make a `tr()` descriptor by default in descriptor wallets so that users will be able to make and use segwit v1 bech32m addresses. ACKs for top commit: MarcoFalke: Concept ACK4868c9f1b3Sjors: re-utACK4868c9f1b3gruve-p: ACK4868c9f1b3meshcollider: Concept + code review ACK4868c9f1b3Tree-SHA512: e5896e665b8d559f1d759b6582d1bb24f70d4698a57307684339d9fdcdac28ae9bc17bc946a7efec9cb35c130a95ffc36e3961a335124ec4535d77b8d00e9631
This commit is contained in:
@@ -851,6 +851,7 @@ protected:
|
||||
builder.Finalize(xpk);
|
||||
WitnessV1Taproot output = builder.GetOutput();
|
||||
out.tr_spenddata[output].Merge(builder.GetSpendData());
|
||||
out.pubkeys.emplace(keys[0].GetID(), keys[0]);
|
||||
return Vector(GetScriptForDestination(output));
|
||||
}
|
||||
bool ToStringSubScriptHelper(const SigningProvider* arg, std::string& ret, const StringType type, const DescriptorCache* cache = nullptr) const override
|
||||
|
||||
@@ -190,8 +190,8 @@ bool FillableSigningProvider::GetCScript(const CScriptID &hash, CScript& redeemS
|
||||
|
||||
CKeyID GetKeyForDestination(const SigningProvider& store, const CTxDestination& dest)
|
||||
{
|
||||
// Only supports destinations which map to single public keys, i.e. P2PKH,
|
||||
// P2WPKH, and P2SH-P2WPKH.
|
||||
// Only supports destinations which map to single public keys:
|
||||
// P2PKH, P2WPKH, P2SH-P2WPKH, P2TR
|
||||
if (auto id = std::get_if<PKHash>(&dest)) {
|
||||
return ToKeyID(*id);
|
||||
}
|
||||
@@ -208,5 +208,15 @@ CKeyID GetKeyForDestination(const SigningProvider& store, const CTxDestination&
|
||||
}
|
||||
}
|
||||
}
|
||||
if (auto output_key = std::get_if<WitnessV1Taproot>(&dest)) {
|
||||
TaprootSpendData spenddata;
|
||||
CPubKey pub;
|
||||
if (store.GetTaprootSpendData(*output_key, spenddata)
|
||||
&& !spenddata.internal_key.IsNull()
|
||||
&& spenddata.merkle_root.IsNull()
|
||||
&& store.GetPubKeyByXOnly(spenddata.internal_key, pub)) {
|
||||
return pub.GetID();
|
||||
}
|
||||
}
|
||||
return CKeyID();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user