ckb-cli icon indicating copy to clipboard operation
ckb-cli copied to clipboard

Suggestion: Add functionality to automatically clear cache when necessary.

Open jordanmack opened this issue 5 years ago • 3 comments

It would be beneficial to automatically clear the ckb-cli cache when it is detected that the active ckb instance differs from what was cached.

As seen below, I had performed a full reset on the dev chain, but the wallet command was still returning information from the deleted chain.

CKB> rpc get_tip_block_number
507
CKB> wallet get-live-cells --lock-hash 0x5094cc3c0e78c997c9c4ed53cdba443739c83cbca9e2487ff3b17b821e61dad9 --limit 1
current_capacity: 2009.88422898 (CKB)
current_count: 1
live_cells:
  - capacity: 2009.88422898 (CKB)
    data_bytes: 0
    index:
      output_index: 0
      tx_index: 0
    lock_hash: 0x5094cc3c0e78c997c9c4ed53cdba443739c83cbca9e2487ff3b17b821e61dad9
    mature: false
    number: 12
    tx_hash: 0x29190882a3975e35bad66ebd57d34f65a135635b250c2ad69ab8014291330b86
    tx_index: 0
    type_hashes: ~
total_capacity: 62565512.94281988 (CKB)
total_count: 55235

jordanmack avatar May 27 '20 06:05 jordanmack

Sounds good to me. Current behave do cause inconvenient when work with dev chain.

TheWaWaR avatar May 27 '20 06:05 TheWaWaR

Current solution: output a error log message:

If you running a dev chain and have removed the database directory (\"ckb/data/db\"), please also remove ckb-cli's index directory:
  /home/xxx/.ckb-cli/index-v1/0x82....
Or you can use follow command to rebuild index database:
  ckb-cli index rebuild-current-db

The the use can use ckb-cli index rebuild-current-db to delete the cache.

TheWaWaR avatar Dec 10 '20 17:12 TheWaWaR

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jul 31 '24 01:07 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Aug 05 '24 01:08 github-actions[bot]