Skip to content

Commit

Permalink
add ckb.verify
Browse files Browse the repository at this point in the history
  • Loading branch information
douyixuan committed Sep 4, 2024
1 parent 2f472a1 commit 7b3249f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 28 additions & 0 deletions pkg/ckb/verify.cell
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package ckb

import (
"blockchain"
)

func verifyByte32(b blockchain.Byte32) bool {
return true
}

func verifyByte(b blockchain.Byte) bool {
return true
}

func verifyScript(script blockchain.Script, compatible bool) bool {
length := uint64(len(script.AsSlice()))
if script.TotalSize() != length {
return false
}
filedCnt := uint64(script.FieldCount())
if !compatible && filedCnt > 3 {
return false
}
if length / 4 < filedCnt + 1 {
return false
}
return true
}
4 changes: 2 additions & 2 deletions third-party/xudt/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ typedef struct
void *ptr;
} SliceType;

void *__slice_get_ptr(SliceType s)
uint8_t *__slice_get_ptr(SliceType *s)
{
return s.ptr;
return s->ptr;
}

void __slice_set_len(SliceType* s, uint32_t len)
Expand Down

0 comments on commit 7b3249f

Please sign in to comment.