mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-06 11:13:02 +02:00
Merge bitcoin/bitcoin#31244: descriptors: MuSig2
5fe7915c86doc: Add musig() example (Ava Chow)d576079ab4tests: Test musig() parsing (Ava Chow)a53924bee3descriptor: Parse musig() key expressions (Ava Chow)9473e9606cdescriptors: Move DeriveType parsing into its own function (Ava Chow)4af0dca096descriptor: Add MuSigPubkeyProvider (Ava Chow)d00d95437dAdd MuSig2 Keyagg Cache helper functions (Ava Chow)8ecea91bf2sign: Add GetMuSig2ParticipantPubkeys to SigningProvider (Ava Chow)fac0ee0bfcbuild: Enable secp256k1 musig module (Ava Chow)1894f97503descriptors: Add PubkeyProvider::IsBIP32() (Ava Chow)12bc1d0b1eutil/string: Allow Split to include the separator (Ava Chow)8811312571script/parsing: Allow Const to not skip the found constant (Ava Chow)5fe4c66462XOnlyPubKey: Add GetCPubKeys (Ava Chow) Pull request description: Implements parsing of BIP 390 `musig()` descriptors. Split from #29675 ACKs for top commit: w0xlt: reACK5fe7915c86rkrux: ACK5fe7915c86theStack: re-ACK5fe7915c86🎹 Sjors: ACK5fe7915c86Tree-SHA512: a5be6288e277187fb9a1e2adf4e9822b46b1b8380d732b2fabd53f317c839aecb1971b04410486cbd65047fbc20956675d4d676f56caa37a44ff0e4d12b9b081
This commit is contained in:
@@ -100,18 +100,30 @@ void ReplaceAll(std::string& in_out, const std::string& search, const std::strin
|
||||
*
|
||||
* If sep does not occur in sp, a singleton with the entirety of sp is returned.
|
||||
*
|
||||
* @param[in] include_sep Whether to include the separator at the end of the left side of the splits.
|
||||
*
|
||||
* Note that this function does not care about braces, so splitting
|
||||
* "foo(bar(1),2),3) on ',' will return {"foo(bar(1)", "2)", "3)"}.
|
||||
*
|
||||
* If include_sep == true, splitting "foo(bar(1),2),3) on ','
|
||||
* will return:
|
||||
* - foo(bar(1),
|
||||
* - 2),
|
||||
* - 3)
|
||||
*/
|
||||
template <typename T = std::span<const char>>
|
||||
std::vector<T> Split(const std::span<const char>& sp, std::string_view separators)
|
||||
std::vector<T> Split(const std::span<const char>& sp, std::string_view separators, bool include_sep = false)
|
||||
{
|
||||
std::vector<T> ret;
|
||||
auto it = sp.begin();
|
||||
auto start = it;
|
||||
while (it != sp.end()) {
|
||||
if (separators.find(*it) != std::string::npos) {
|
||||
ret.emplace_back(start, it);
|
||||
if (include_sep) {
|
||||
ret.emplace_back(start, it + 1);
|
||||
} else {
|
||||
ret.emplace_back(start, it);
|
||||
}
|
||||
start = it + 1;
|
||||
}
|
||||
++it;
|
||||
@@ -128,9 +140,9 @@ std::vector<T> Split(const std::span<const char>& sp, std::string_view separator
|
||||
* "foo(bar(1),2),3) on ',' will return {"foo(bar(1)", "2)", "3)"}.
|
||||
*/
|
||||
template <typename T = std::span<const char>>
|
||||
std::vector<T> Split(const std::span<const char>& sp, char sep)
|
||||
std::vector<T> Split(const std::span<const char>& sp, char sep, bool include_sep = false)
|
||||
{
|
||||
return Split<T>(sp, std::string_view{&sep, 1});
|
||||
return Split<T>(sp, std::string_view{&sep, 1}, include_sep);
|
||||
}
|
||||
|
||||
[[nodiscard]] inline std::vector<std::string> SplitString(std::string_view str, char sep)
|
||||
|
||||
Reference in New Issue
Block a user