File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ class transaction_identifier
4242 /* * Wrapped `uint256` methods. */
4343 constexpr bool IsNull () const { return m_wrapped.IsNull (); }
4444 constexpr void SetNull () { m_wrapped.SetNull (); }
45+ static std::optional<transaction_identifier> FromHex (std::string_view hex)
46+ {
47+ auto u{uint256::FromHex (hex)};
48+ if (!u) return std::nullopt ;
49+ return FromUint256 (*u);
50+ }
4551 std::string GetHex () const { return m_wrapped.GetHex (); }
4652 std::string ToString () const { return m_wrapped.ToString (); }
4753 static constexpr auto size () { return decltype (m_wrapped)::size (); }
@@ -66,6 +72,7 @@ using Txid = transaction_identifier<false>;
6672/* * Wtxid commits to all transaction fields including the witness. */
6773using Wtxid = transaction_identifier<true >;
6874
75+ /* * DEPRECATED due to missing length-check and hex-check, please use the safer FromHex, or FromUint256 */
6976inline Txid TxidFromString (std::string_view str)
7077{
7178 return Txid::FromUint256 (uint256S (str));
You can’t perform that action at this time.
0 commit comments