Skip to content

Commit a665edb

Browse files
fix(wasm-utxo): swap internal and external chain values for taproot
The taproot chains had internal/external values swapped compared to other script types. This commit fixes the enum values to be consistent, making external chains have even values and internal chains have odd values. This is not a breaking change since the internal/external distinctions were not surfaced in the public API. Co-authored-by: llm-git <llm-git@ttll.de> Issue: BTC-2916
1 parent 0c79108 commit a665edb

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

  • packages/wasm-utxo/src/fixed_script_wallet/wallet_scripts

packages/wasm-utxo/src/fixed_script_wallet/wallet_scripts/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ pub enum Chain {
128128
P2shP2wshInternal = 11,
129129
P2wshExternal = 20,
130130
P2wshInternal = 21,
131-
P2trInternal = 30,
132-
P2trExternal = 31,
133-
P2trMusig2Internal = 40,
134-
P2trMusig2External = 41,
131+
P2trExternal = 30,
132+
P2trInternal = 31,
133+
P2trMusig2External = 40,
134+
P2trMusig2Internal = 41,
135135
}
136136

137137
/// Useful for iterating over enum values
@@ -142,10 +142,10 @@ const ALL_CHAINS: [Chain; 10] = [
142142
Chain::P2shP2wshInternal,
143143
Chain::P2wshExternal,
144144
Chain::P2wshInternal,
145-
Chain::P2trInternal,
146145
Chain::P2trExternal,
147-
Chain::P2trMusig2Internal,
146+
Chain::P2trInternal,
148147
Chain::P2trMusig2External,
148+
Chain::P2trMusig2Internal,
149149
];
150150

151151
impl Chain {
@@ -272,28 +272,28 @@ mod tests {
272272
assert_output_script(
273273
keys,
274274
chain,
275-
"51203a81504b836967a69399fcf3822adfdb7d61061e42418f6aad0d473cbcc69b86",
275+
"512093e5e3c8885a6f87b4449e1bffa3ba8a45a9ee634dc27408394c7d9b68f01adc",
276276
);
277277
}
278278
Chain::P2trExternal => {
279279
assert_output_script(
280280
keys,
281281
chain,
282-
"512093e5e3c8885a6f87b4449e1bffa3ba8a45a9ee634dc27408394c7d9b68f01adc",
282+
"51203a81504b836967a69399fcf3822adfdb7d61061e42418f6aad0d473cbcc69b86",
283283
);
284284
}
285285
Chain::P2trMusig2Internal => {
286286
assert_output_script(
287287
keys,
288288
chain,
289-
"5120c7c4dd55b2bf3cd7ea5b27d3da521699ce761aa345523d8486f0336364957ef2",
289+
"51202629eea5dbef6841160a0b752dedd4b8e206f046835ee944848679d6dea2ac2c",
290290
);
291291
}
292292
Chain::P2trMusig2External => {
293293
assert_output_script(
294294
keys,
295295
chain,
296-
"51202629eea5dbef6841160a0b752dedd4b8e206f046835ee944848679d6dea2ac2c",
296+
"5120c7c4dd55b2bf3cd7ea5b27d3da521699ce761aa345523d8486f0336364957ef2",
297297
);
298298
}
299299
}

0 commit comments

Comments
 (0)