Skip to content

Commit b9a04c1

Browse files
committed
Rename Balance::claimable_amount_satoshis to have a unique name
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 method `definitely_claimable_amount_satoshis`.
1 parent 685f266 commit b9a04c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ impl Balance {
654654
/// [`Balance::MaybePreimageClaimableHTLC`].
655655
///
656656
/// On-chain fees required to claim the balance are not included in this amount.
657-
pub fn claimable_amount_satoshis(&self) -> u64 {
657+
pub fn definitely_claimable_amount_satoshis(&self) -> u64 {
658658
match self {
659659
Balance::ClaimableOnChannelClose {
660660
claimable_amount_satoshis,

0 commit comments

Comments
 (0)