From 43f6fc048c453e6cab05cdb95422dda40861dad9 Mon Sep 17 00:00:00 2001 From: h4sh3d Date: Sun, 5 Dec 2021 16:27:51 +0100 Subject: [PATCH] Add bitcoin variant for Bitcoin FromStr (#193) * Add bitcoin variant for Bitcoin FromStr * Update changelog --- CHANGELOG.md | 1 + src/bitcoin/segwitv0.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90861765..f419e2f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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` implementation of `FromStr` ([#193](https://github.com/farcaster-project/farcaster-core/pull/193)) ### Fixed diff --git a/src/bitcoin/segwitv0.rs b/src/bitcoin/segwitv0.rs index ac228b02..e4e92fbe 100644 --- a/src/bitcoin/segwitv0.rs +++ b/src/bitcoin/segwitv0.rs @@ -71,7 +71,7 @@ impl FromStr for Bitcoin { fn from_str(s: &str) -> Result { match s { - "SegwitV0" | "ECDSA" => Ok(Self::new()), + "SegwitV0" | "ECDSA" | "Bitcoin" | "bitcoin" => Ok(Self::new()), _ => Err(consensus::Error::UnknownType), } } @@ -508,5 +508,9 @@ mod tests { assert!(parse.is_ok()); let parse = Bitcoin::::from_str("ECDSA"); assert!(parse.is_ok()); + let parse = Bitcoin::::from_str("Bitcoin"); + assert!(parse.is_ok()); + let parse = Bitcoin::::from_str("bitcoin"); + assert!(parse.is_ok()); } }