commit 9d4d47f4a417639d1f59b730af409d5eb1c8c561
parent bf5979fb35fc50a0e94764cc0b73f1e440dea4b9
Author: Florian Dold <dold@taler.net>
Date: Tue, 21 Jul 2026 10:54:55 +0200
util: test that payto bitcoin accepts taproot addresses
Diffstat:
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/packages/taler-util/src/payto.test.ts b/packages/taler-util/src/payto.test.ts
@@ -319,3 +319,24 @@ test("payto scheme and target type are case insensitive", (t) => {
);
}
});
+
+test("payto bitcoin accepts every witness version", (t) => {
+ // Taproot addresses are version 1 witness programs and use the bech32m
+ // checksum, so validating against bech32 alone rejects them.
+ const taproot =
+ "payto://bitcoin/bc1p0xlxvlhemja6c4dqv22uapctqupfhlxm9h8z3k2e72q4k9hcz7vqzk5jj0";
+ assert.strictEqual(Paytos.fromString(taproot).tag, "ok");
+ assert.strictEqual(
+ Paytos.fromString(
+ "payto://bitcoin/bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
+ ).tag,
+ "ok",
+ );
+ // A version 0 program checksummed with bech32m stays invalid.
+ assert.strictEqual(
+ Paytos.fromString(
+ "payto://bitcoin/bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kemeawh",
+ ).tag,
+ "error",
+ );
+});