nervosnetwork / ckb-light-client

CKB light client reference implementation
MIT License
14 stars 16 forks source link

[get_cell] get_cell is wrong #183

Closed gpBlockchain closed 7 months ago

gpBlockchain commented 7 months ago

sync account : https://explorer.nervos.org/address/ckb1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqfs5yk06qlum25l92rp9tuukpf39g0gtqcxcat9g

Wait for the light client sync tip number; querying get_cell returns a result that is not equal to the CKB full node.

light ret

image

full node ret

image

step:

# start ckb 
RUST_LOG=info,ckb_light_client=trace ./ckb-light-client run --config-file config/mainnet.toml

# set script : 11987550
curl --location --request POST 'http://127.0.0.1:9000' \
--header 'Content-Type: application/json' \
--data-raw '{
        "jsonrpc":"2.0",
        "method":"set_scripts",
        "params":[[{"script":{"code_hash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8","hash_type":"type","args":"0x30a12cfd03fcdaa9f2a8612af9cb05312a1e8583"},"script_type":"lock","block_number":"0xb6ea5e"}],"all"],
        "id":64                  
}'

# wait sync successful 
# query get_cell
curl --location --request POST 'http://127.0.0.1:9000' \
--header 'Content-Type: application/json' \
--data '{    
        "jsonrpc":"2.0",
        "method":"get_cells",  
        "params":[  { "script": {"code_hash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8","hash_type":"type","args":"0x30a12cfd03fcdaa9f2a8612af9cb05312a1e8583"},    "script_type": "lock"},"asc",   "0x3E8"],  "id":64}'