Skip to content

Commit

Permalink
Add bitcoin variant for Bitcoin<Segwit> FromStr (#193)
Browse files Browse the repository at this point in the history
* Add bitcoin variant for Bitcoin<Segwit> FromStr

* Update changelog
  • Loading branch information
h4sh3d authored Dec 5, 2021
1 parent d3245ac commit 43f6fc0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Add `"monero"` and `"xmr"` variants for Monero `FromStr` impl ([#192](https://github.com/farcaster-project/farcaster-core/pull/192))
- Add `"bitcoin"` variant for `Bitcoin<Segwit>` implementation of `FromStr` ([#193](https://github.com/farcaster-project/farcaster-core/pull/193))

### Fixed

Expand Down
6 changes: 5 additions & 1 deletion src/bitcoin/segwitv0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl FromStr for Bitcoin<SegwitV0> {

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"SegwitV0" | "ECDSA" => Ok(Self::new()),
"SegwitV0" | "ECDSA" | "Bitcoin" | "bitcoin" => Ok(Self::new()),
_ => Err(consensus::Error::UnknownType),
}
}
Expand Down Expand Up @@ -508,5 +508,9 @@ mod tests {
assert!(parse.is_ok());
let parse = Bitcoin::<SegwitV0>::from_str("ECDSA");
assert!(parse.is_ok());
let parse = Bitcoin::<SegwitV0>::from_str("Bitcoin");
assert!(parse.is_ok());
let parse = Bitcoin::<SegwitV0>::from_str("bitcoin");
assert!(parse.is_ok());
}
}

0 comments on commit 43f6fc0

Please sign in to comment.