Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Use bigint exclusively to represent balances. #147

Merged
merged 2 commits into from
Oct 19, 2023
Merged

Use bigint exclusively to represent balances. #147

merged 2 commits into from
Oct 19, 2023

Conversation

geoknee
Copy link
Contributor

@geoknee geoknee commented Oct 19, 2023

Closes #126

Number(this.getOwnerBalance()) < BigInt(amount)
(await this.getOwnerBalance()) < amount
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we were actually casting a promise to a number, which results in nan < amount which is always false. So this check was completely broken.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yowsa. Good catch.

Because we're good wallet developers, I think there's at least a 60% chance that the intermediary would reject HTLCs that should have failed here.

Copy link
Contributor

@NiloCK NiloCK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice improvement that yielded a substantive bug squash. 👍

@NiloCK NiloCK merged commit 8ef236e into main Oct 19, 2023
@geoknee geoknee deleted the bigints branch October 19, 2023 13:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert balances to bigints
2 participants