Skip to content

Commit c427074

Browse files
authored
Merge pull request #706 from evoskuil/master
Change electrum notifications to node::chase::organized.
2 parents 8c6c658 + b7a6720 commit c427074

3 files changed

Lines changed: 12 additions & 16 deletions

File tree

include/bitcoin/server/protocols/protocol_electrum.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,15 @@ class BCS_API protocol_electrum
245245
const hash_digest& status) NOEXCEPT;
246246
void notify_status(const code& ec, const hash_digest& hash,
247247
const hash_digest& status, notify_t type,
248-
node::address_t link) NOEXCEPT;
248+
node::header_t link) NOEXCEPT;
249249

250250
/// Notification senders and send handlers.
251251
/// -----------------------------------------------------------------------
252252

253253
void do_height(node::header_t link) NOEXCEPT;
254254
void do_header(node::header_t link) NOEXCEPT;
255255
void do_outpoint(node::header_t link) NOEXCEPT;
256-
void do_scripthash(node::address_t link) NOEXCEPT;
256+
void do_scripthash(node::header_t link) NOEXCEPT;
257257

258258
/// Utilities.
259259
/// -----------------------------------------------------------------------

src/protocols/electrum/protocol_electrum.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ bool protocol_electrum::handle_event(const code&, node::chase event_,
140140
constexpr auto relaxed = std::memory_order_relaxed;
141141
switch (event_)
142142
{
143+
////case node::chase::transaction:
143144
case node::chase::organized:
144145
{
145146
if (subscribed_height_.load(relaxed))
@@ -154,22 +155,17 @@ bool protocol_electrum::handle_event(const code&, node::chase event_,
154155
POST(do_header, std::get<node::header_t>(value));
155156
}
156157

157-
break;
158-
}
159-
case node::chase::spent:
160-
case node::chase::received:
161-
{
162158
if (subscribed_outpoint_.load(relaxed))
163159
{
164-
BC_ASSERT(std::holds_alternative<node::address_t>(value));
165-
POST(do_outpoint, std::get<node::address_t>(value));
160+
BC_ASSERT(std::holds_alternative<node::header_t>(value));
161+
POST(do_outpoint, std::get<node::header_t>(value));
166162
}
167163

168164
if (subscribed_scripthash_.load(relaxed))
169165
{
170166
BC_ASSERT(archive().address_enabled());
171-
BC_ASSERT(std::holds_alternative<node::address_t>(value));
172-
POST(do_scripthash, std::get<node::address_t>(value));
167+
BC_ASSERT(std::holds_alternative<node::header_t>(value));
168+
POST(do_scripthash, std::get<node::header_t>(value));
173169
}
174170

175171
break;
@@ -230,7 +226,7 @@ void protocol_electrum::do_header(node::header_t link) NOEXCEPT
230226
}
231227

232228
// Notifier for blockchain_outpoint_subscribe events.
233-
void protocol_electrum::do_outpoint(node::address_t link) NOEXCEPT
229+
void protocol_electrum::do_outpoint(node::header_t link) NOEXCEPT
234230
{
235231
BC_ASSERT(stranded());
236232

@@ -254,7 +250,7 @@ void protocol_electrum::do_outpoint(node::address_t link) NOEXCEPT
254250
}
255251

256252
// Notifier for blockchain_scripthash_subscribe events.
257-
void protocol_electrum::do_scripthash(node::address_t link) NOEXCEPT
253+
void protocol_electrum::do_scripthash(node::header_t link) NOEXCEPT
258254
{
259255
BC_ASSERT(stranded());
260256

@@ -269,7 +265,7 @@ void protocol_electrum::do_scripthash(node::address_t link) NOEXCEPT
269265
}
270266

271267
void protocol_electrum::notify_status(const code& ec, const hash_digest& hash,
272-
const hash_digest& status, notify_t type, node::address_t link) NOEXCEPT
268+
const hash_digest& status, notify_t type, node::header_t link) NOEXCEPT
273269
{
274270
BC_ASSERT(stranded());
275271

test/protocols/electrum/electrum_transactions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ BOOST_AUTO_TEST_CASE(electrum__blockchain_transaction_broadcast__invalid_tx__inv
6161
BOOST_REQUIRE_EQUAL(response.at("error").as_object().at("code").as_int64(), invalid_argument.value());
6262
}
6363

64-
BOOST_AUTO_TEST_CASE(electrum__blockchain_transaction_broadcast__genesis_coinbase__coinbase_transaction_response)
64+
BOOST_AUTO_TEST_CASE(electrum__blockchain_transaction_broadcast__v1_0_genesis_coinbase__coinbase_transaction_response)
6565
{
6666
BOOST_REQUIRE(handshake(electrum::version::v1_0));
6767

@@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE(electrum__blockchain_transaction_broadcast__genesis_coinbas
7272
BOOST_REQUIRE_EQUAL(response.at("result").as_string(), coinbase_transaction.message());
7373
}
7474

75-
BOOST_AUTO_TEST_CASE(electrum__blockchain_transaction_broadcast__genesis_coinbase__coinbase_transaction_error)
75+
BOOST_AUTO_TEST_CASE(electrum__blockchain_transaction_broadcast__v1_6_genesis_coinbase__coinbase_transaction_error)
7676
{
7777
BOOST_REQUIRE(handshake(electrum::version::v1_6));
7878

0 commit comments

Comments
 (0)