Skip to content

Commit

Permalink
Automatic conversion of recid (ckb-devrel#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson authored Jul 17, 2024
1 parent bc6f6b7 commit ce4856a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion checksums.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
90ac5917faf6acad047e217b14181869dc7801044223d58d5c7dfdb4cbd07672 build/release/ccc-btc-lock
bef047973a601d7bab6bcbf638f4c92a41a471fa53d5bf44f7233d3340b30e01 build/release/ccc-btc-lock
6 changes: 5 additions & 1 deletion contracts/ccc-btc-lock/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ pub fn entry() -> Result<(), Error> {
if sig.len() != 65 {
return Err(Error::WrongSignatureFormat);
}
let rec_id = sig[0];
let rec_id = match sig[0] {
31 | 32 | 33 | 34 => sig[0] - 31,
39 | 40 | 41 | 42 => sig[0] - 39,
_ => sig[0],
};
let rec_id = RecoveryId::try_from(rec_id).map_err(|_| Error::InvalidRecoverId)?;
let signature = Signature::from_slice(&sig[1..]).map_err(|_| Error::WrongSignatureFormat)?;
let recovered_key = VerifyingKey::recover_from_prehash(&msg, &signature, rec_id)
Expand Down

0 comments on commit ce4856a

Please sign in to comment.