Drop `claimable` from `Balance::claimable_amount_satoshis` fields
authorMatt Corallo <git@bluematt.me>
Fri, 28 Jul 2023 06:20:43 +0000 (06:20 +0000)
committerMatt Corallo <git@bluematt.me>
Sun, 30 Jul 2023 02:26:48 +0000 (02:26 +0000)
commit3d1783880550cfe41276abf3d4296284d9abc780
tree05f133f4488b5a2f32f004fbea1eb2e833b45469
parente794e9ebeede18e0bd30c68a1d1784894b94fe5d
Drop `claimable` from `Balance::claimable_amount_satoshis` fields

In Java/TypeScript, we map enums as a base class and each variant
as a class which extends the base. In Java/TypeScript, functions
and fields share the same namespace, which means we cannot have
functions on an enum which have the same name as any fields in any
enum variants.

`Balance`'s `claimable_amount_satoshis` method aliases with fields
in each variant, and thus ultimately doesn't compile in TypeScript.

Because `Balance::claimable_amount_satoshis` has the same name as
the fields, it's also a bit confusing, as it doesn't return the
field for each variant, but sometimes returns zero if we're not
sure we can claim the balance.

Instead, we rename the fields in each enum variant to simply
`amount_satoshis`, to avoid implying that we can definitely claim
the balance.
lightning/src/chain/channelmonitor.rs
lightning/src/ln/monitor_tests.rs