-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add single random draw selection algorithm
- Loading branch information
1 parent
776648d
commit 249785f
Showing
6 changed files
with
652 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# 0.1.0 - 2022-12-17 | ||
|
||
* Initial release. | ||
|
||
# 0.2.0 - 2023-06-03 | ||
|
||
- Add Single Random Draw module and a basic error type. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
msrv = "1.41.1" | ||
msrv = "1.48.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/// Error types. | ||
use bitcoin::FeeRate; | ||
use bitcoin::Weight; | ||
use std::error::Error as E; | ||
use std::fmt; | ||
|
||
#[derive(Debug)] | ||
pub enum Error { | ||
Multiplication(Weight, FeeRate), | ||
SizeMismatch(usize, usize) | ||
} | ||
|
||
impl E for Error {} | ||
|
||
impl fmt::Display for Error { | ||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
match self { | ||
Error::Multiplication(weight, fee_rate) => { | ||
write!(f, "{} * {} exceeds u64 Max", weight, fee_rate) | ||
}, | ||
Error::SizeMismatch(input_count, output_count) => { | ||
write!(f, "the number of inputs: {} and outputs: {} does not match", input_count, output_count) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.