From 943417de0bb4d9ced3061b354d93743390e1320b Mon Sep 17 00:00:00 2001 From: Martin Rieke <121793148+martin-chainflip@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:16:10 +0200 Subject: [PATCH] handle special value of 129 in btc scripts (#4073) --- state-chain/chains/src/btc.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/state-chain/chains/src/btc.rs b/state-chain/chains/src/btc.rs index d03039b053..815d441c54 100644 --- a/state-chain/chains/src/btc.rs +++ b/state-chain/chains/src/btc.rs @@ -912,6 +912,7 @@ impl SerializeBtc for BitcoinOp { BitcoinOp::PushUint { value } => match value { 0 => buf.push(0), 1..=16 => buf.push(0x50 + *value as u8), + 129 => buf.push(0x4f), _ => { let num_bytes = sp_std::mem::size_of::() - (value.leading_zeros() / 8) as usize; @@ -1254,6 +1255,9 @@ mod test { (2, vec![82]), (16, vec![96]), (17, vec![1, 17]), + (128, vec![1, 128]), + (129, vec![79]), + (130, vec![1, 130]), (255, vec![1, 255]), (256, vec![2, 0, 1]), (11394560, vec![3, 0, 0xDE, 0xAD]),