@@ -94,7 +94,16 @@ void protocol_electrum::handle_blockchain_outpoint_get_status(const code& ec,
9494 return ;
9595 }
9696
97- send_get_status (tx_hash, txout_idx, spk_hint);
97+ uint32_t index{};
98+ hash_digest hash{};
99+ if (!to_integer (index, txout_idx) || !decode_hash (hash, tx_hash))
100+ {
101+ send_code (error::invalid_argument);
102+ return ;
103+ }
104+
105+ chain::point prevout{ hash, index };
106+ send_get_status (prevout, spk_hint);
98107}
99108
100109void protocol_electrum::handle_blockchain_outpoint_subscribe (const code& ec,
@@ -110,10 +119,19 @@ void protocol_electrum::handle_blockchain_outpoint_subscribe(const code& ec,
110119 return ;
111120 }
112121
113- if (!send_get_status (tx_hash, txout_idx, spk_hint))
122+ uint32_t index{};
123+ hash_digest hash{};
124+ if (!to_integer (index, txout_idx) || !decode_hash (hash, tx_hash))
125+ {
126+ send_code (error::invalid_argument);
127+ return ;
128+ }
129+
130+ chain::point prevout{ hash, index };
131+ if (!send_get_status (prevout, spk_hint))
114132 return ;
115133
116- // TODO: collect the outpoint into a limited notification set.
134+ // TODO: collect prevout into a limited notification set.
117135 subscribed_outpoint_.store (false , std::memory_order_relaxed);
118136}
119137
@@ -139,7 +157,7 @@ void protocol_electrum::handle_blockchain_outpoint_unsubscribe(const code& ec,
139157 return ;
140158 }
141159
142- // TODO: remove outpoint subscription from notification set.
160+ // TODO: remove prevout subscription from notification set.
143161 chain::point prevout{ hash, index };
144162 const auto previous = subscribed_scriptpubkey_.load (
145163 std::memory_order_relaxed);
@@ -150,17 +168,9 @@ void protocol_electrum::handle_blockchain_outpoint_unsubscribe(const code& ec,
150168// utility.
151169// ----------------------------------------------------------------------------
152170
153- bool protocol_electrum::send_get_status (const std::string& tx_hash ,
154- double txout_idx, const std::string& spk_hint) NOEXCEPT
171+ bool protocol_electrum::send_get_status (const chain::point& prevout ,
172+ const std::string& spk_hint) NOEXCEPT
155173{
156- uint32_t index{};
157- hash_digest hash{};
158- if (!to_integer (index, txout_idx) || !decode_hash (hash, tx_hash))
159- {
160- send_code (error::invalid_argument);
161- return false ;
162- }
163-
164174 // This is parsed for correctness but is not used.
165175 // Script is advisory, and should match output script.
166176 if (!spk_hint.empty ())
@@ -181,14 +191,14 @@ bool protocol_electrum::send_get_status(const std::string& tx_hash,
181191 }
182192
183193 const auto & query = archive ();
184- const auto out = query.get_tx_history (hash);
194+ const auto out = query.get_tx_history (prevout. hash () );
185195 if (!out.tx .is_valid ())
186196 {
187197 send_code (error::not_found);
188198 return false ;
189199 }
190200
191- if (const auto ins = query.get_spenders_history (hash, index ); ins.empty ())
201+ if (const auto ins = query.get_spenders_history (prevout ); ins.empty ())
192202 {
193203 send_result (object_t
194204 {
0 commit comments