utxostack / ckb-bitcoin-spv-service

Synchronize headers to Bitcoin SPV clients running on the CKB chain.
MIT License
1 stars 4 forks source link

refactor: don't allow `limit = 0` #20

Closed yangby-cryptape closed 5 months ago

yangby-cryptape commented 5 months ago

Description

Personally, I feel 0 means no limit is a bit special. Without special treatment, it should mean forbidden.

Another way to change(for reference only)

storage.generate_spv_client_and_spv_update(spv_tip_height, None)? ;
  if let Some(limit) = limit {
      tip_height = std::cmp::min(tip_height, prev_height.saturating_add(limit));
  }

_Originally posted by @EthanYuan in https://github.com/ckb-cell/ckb-bitcoin-spv-service/pull/14#discussion_r1548875442_