Skip to content

Remove unnecessary panic from from_int_btc_const#3932

Closed
shinghim wants to merge 1 commit intorust-bitcoin:masterfrom
shinghim:3779-remove-panic
Closed

Remove unnecessary panic from from_int_btc_const#3932
shinghim wants to merge 1 commit intorust-bitcoin:masterfrom
shinghim:3779-remove-panic

Conversation

@shinghim
Copy link
Copy Markdown
Contributor

Fixes #3779

@github-actions github-actions bot added the C-units PRs modifying the units crate label Jan 20, 2025
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 12861190692

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 83.074%

Totals Coverage Status
Change from base Build 12859956216: 0.002%
Covered Lines: 20845
Relevant Lines: 25092

💛 - Coveralls

@shinghim shinghim marked this pull request as ready for review January 20, 2025 05:26
tcharding added a commit to tcharding/rust-bitcoin that referenced this pull request Jan 20, 2025
In preparation for release add a changelog entry, bump the version, and
update the lock files.

`v1.0` here we come.

Before we merge this we should add:

- rust-bitcoin#3934 or rust-bitcoin#3866
- rust-bitcoin#3933
- rust-bitcoin#3932
- rust-bitcoin#3929
- rust-bitcoin#3926
- rust-bitcoin#3923
- rust-bitcoin#3893
- rust-bitcoin#3866
- rust-bitcoin#3794
Copy link
Copy Markdown
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

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

ACK 64d1be0

@tcharding
Copy link
Copy Markdown
Member

I'm happy to merge this but it is made redundant by #3794 - I could have thought that through more fully before raising the PR.

@tcharding
Copy link
Copy Markdown
Member

Thanks @shinghim!

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 64d1be0; successfully ran local tests

Some(amount) => Amount::from_sat(amount),
None => panic!("checked_mul overflowed"),
}
Amount(btc * 100_000_000) // Don't need checked multiplication: u32::MAX * 100_000_000 < u64::MAX
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shouldn't the comment say < MAX_MONEY instead of < u64::MAX? Which it's not..

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Currently the unsigned module is not enforcing the MAX_MONEY invariant.

@tcharding
Copy link
Copy Markdown
Member

Merge merge merge. Part of #3935 - LFG!

@apoelstra
Copy link
Copy Markdown
Member

Oh, sorry, I've been ignoring this because you said it was obsoleted by #3794 which I haven't reviewed yet.

@tcharding
Copy link
Copy Markdown
Member

woops, I just saw that I'd acked it and it was on the list.

@tcharding
Copy link
Copy Markdown
Member

Lets just close. @shinghim hope that is ok with you.

@shinghim
Copy link
Copy Markdown
Contributor Author

Good with me 👍🏼

@shinghim shinghim closed this Jan 23, 2025
tcharding added a commit to tcharding/rust-bitcoin that referenced this pull request Feb 24, 2025
We are trying a new strategy to get to 1.0 more quickly - remove
`amount` and `fee` and release everything else.

In preparation for release add a changelog entry, bump the version, and
update the lock files.

`v1.0` here we come.

Before we merge this we should add:

- rust-bitcoin#3934 or rust-bitcoin#3866
- rust-bitcoin#3933
- rust-bitcoin#3932
- rust-bitcoin#3929
- rust-bitcoin#3926
- rust-bitcoin#3923
- rust-bitcoin#3893
- rust-bitcoin#3866
- rust-bitcoin#3794
tcharding added a commit to tcharding/rust-bitcoin that referenced this pull request Feb 24, 2025
We are trying a new strategy to get to 1.0 more quickly - remove
`amount` and `fee` and release everything else.

In preparation for release add a changelog entry, bump the version, and
update the lock files.

`v1.0` here we come.

Before we merge this we should add:

- rust-bitcoin#3934 or rust-bitcoin#3866
- rust-bitcoin#3933
- rust-bitcoin#3932
- rust-bitcoin#3929
- rust-bitcoin#3926
- rust-bitcoin#3923
- rust-bitcoin#3893
- rust-bitcoin#3866
- rust-bitcoin#3794
tcharding added a commit to tcharding/rust-bitcoin that referenced this pull request Feb 24, 2025
We are trying a new strategy to get to 1.0 more quickly - remove
`amount` and `fee` and release everything else.

In preparation for release add a changelog entry, bump the version, and
update the lock files.

`v1.0` here we come.

Before we merge this we should add:

- rust-bitcoin#3934 or rust-bitcoin#3866
- rust-bitcoin#3933
- rust-bitcoin#3932
- rust-bitcoin#3929
- rust-bitcoin#3926
- rust-bitcoin#3923
- rust-bitcoin#3893
- rust-bitcoin#3866
- rust-bitcoin#3794
tcharding added a commit to tcharding/rust-bitcoin that referenced this pull request Feb 24, 2025
We are trying a new strategy to get to 1.0 more quickly - remove
`amount` and `fee` and release everything else.

In preparation for release add a changelog entry, bump the version, and
update the lock files.

`v1.0` here we come.

Before we merge this we should add:

- rust-bitcoin#3934 or rust-bitcoin#3866
- rust-bitcoin#3933
- rust-bitcoin#3932
- rust-bitcoin#3929
- rust-bitcoin#3926
- rust-bitcoin#3923
- rust-bitcoin#3893
- rust-bitcoin#3866
- rust-bitcoin#3794
tcharding added a commit to tcharding/rust-bitcoin that referenced this pull request Feb 24, 2025
We are trying a new strategy to get to 1.0 more quickly - remove
`amount` and `fee` and release everything else.

In preparation for release add a changelog entry, bump the version, and
update the lock files.

`v1.0` here we come.

Before we merge this we should add:

- rust-bitcoin#3934 or rust-bitcoin#3866
- rust-bitcoin#3933
- rust-bitcoin#3932
- rust-bitcoin#3929
- rust-bitcoin#3926
- rust-bitcoin#3923
- rust-bitcoin#3893
- rust-bitcoin#3866
- rust-bitcoin#3794
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-units PRs modifying the units crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

from_int_btc_const can't panic

5 participants