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
42
42
/* * Wrapped `uint256` methods. */
43
43
constexpr bool IsNull () const { return m_wrapped.IsNull (); }
44
44
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
+ }
45
51
std::string GetHex () const { return m_wrapped.GetHex (); }
46
52
std::string ToString () const { return m_wrapped.ToString (); }
47
53
static constexpr auto size () { return decltype (m_wrapped)::size (); }
@@ -66,6 +72,7 @@ using Txid = transaction_identifier<false>;
66
72
/* * Wtxid commits to all transaction fields including the witness. */
67
73
using Wtxid = transaction_identifier<true >;
68
74
75
+ /* * DEPRECATED due to missing length-check and hex-check, please use the safer FromHex, or FromUint256 */
69
76
inline Txid TxidFromString (std::string_view str)
70
77
{
71
78
return Txid::FromUint256 (uint256S (str));
You can’t perform that action at this time.
0 commit comments