Skip to content

Commit

Permalink
handle special value of 129 in btc scripts (#4073)
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-chainflip authored Oct 4, 2023
1 parent 7882e30 commit 943417d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions state-chain/chains/src/btc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<u32>() - (value.leading_zeros() / 8) as usize;
Expand Down Expand Up @@ -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]),
Expand Down

0 comments on commit 943417d

Please sign in to comment.