babylonlabs-io / babylon-staking-indexer

Other
0 stars 2 forks source link

fix: withdrawn state issue #71

Closed gusin13 closed 3 hours ago

gusin13 commented 1 day ago

Fixes - https://github.com/babylonlabs-io/babylon-staking-indexer/issues/67

This pr

  1. fixes race condition while updating delegation state in db. (should use $in to verify while updating that current state is in qualified state)
  2. includes the assumption that expiry checker is bit slow and in meanwhile btc subscription if encounters the spending tx should be able to update the state (expiry checker won't be later able to update/modify the state - related to race condition above)
  3. adds extensive logs in state transitioning - we can keep this temporarily for now in devnet