nervosnetwork / ckb-cli

CKB command line interface
MIT License
55 stars 35 forks source link

fix(rpc sync_state): fix ckb-cli rpc sync_state error #465

Closed chanhsu001 closed 2 years ago

chanhsu001 commented 2 years ago

when ckb-cli rpc sync_state, the error message is: missing field "unknown_header_list_size"

Cause

sync_state() in client.rs wrongly returns PeerSyncState instead of SyncState

Fix

Verify

$ ./ckb-cli rpc sync_state best_known_block_number: 7211562 best_known_block_timestamp: "1653289577050 (2022-05-23 15:06:17.050 +08:00)" fast_time: 595 ibd: false inflight_blocks_count: 0 low_time: 1319 normal_time: 1136 orphan_blocks_count: 0

$ ./ckb-cli rpc sync_state --raw-data best_known_block_number: 0x6e0a2c best_known_block_timestamp: 0x180efbd198f fast_time: 0x253 ibd: false inflight_blocks_count: 0x0 low_time: 0x527 normal_time: 0x470 orphan_blocks_count: 0x0

TheWaWaR commented 2 years ago

For the inner rpc client it has been fixed in ckb-sdk v1.0.1, for the wrapper type (types::SyncState) please rebase the PR.

https://github.com/nervosnetwork/ckb-sdk-rust/pull/8

TheWaWaR commented 2 years ago

Fixed in #472