@@ -45,6 +45,7 @@ void protocol_transaction_out_106::start() NOEXCEPT
4545
4646 // Events subscription is asynchronous, events may be missed.
4747 subscribe_chase (BIND (handle_chase, _1, _2, _3));
48+ SUBSCRIBE_BROADCAST (transaction, handle_broadcast_transaction, _1, _2, _3);
4849 SUBSCRIBE_CHANNEL (get_data, handle_receive_get_data, _1, _2);
4950 protocol_peer::start ();
5051}
@@ -54,6 +55,7 @@ void protocol_transaction_out_106::stopping(const code& ec) NOEXCEPT
5455 // Unsubscriber race is ok.
5556 BC_ASSERT (stranded ());
5657 unsubscribe_chase ();
58+ UNSUBSCRIBE_BROADCAST ();
5759 protocol_peer::stopping (ec);
5860}
5961
@@ -98,8 +100,30 @@ bool protocol_transaction_out_106::do_announce(transaction_t link) NOEXCEPT
98100 if (stopped ())
99101 return false ;
100102
101- // Don't announce to peer that announced to us.
102- const auto hash = query.get_tx_key (link);
103+ return announce (query.get_tx_key (link));
104+ }
105+
106+ bool protocol_transaction_out_106::handle_broadcast_transaction (const code& ec,
107+ const transaction::cptr& message, uint64_t sender) NOEXCEPT
108+ {
109+ BC_ASSERT (stranded ());
110+
111+ if (stopped (ec))
112+ return false ;
113+
114+ if (sender == identifier ())
115+ return true ;
116+
117+ if (!message || !message->transaction_ptr )
118+ return true ;
119+
120+ return announce (message->transaction_ptr ->hash (false ));
121+ }
122+
123+ bool protocol_transaction_out_106::announce (const hash_digest& hash) NOEXCEPT
124+ {
125+ BC_ASSERT (stranded ());
126+
103127 if (was_announced (hash))
104128 return true ;
105129
0 commit comments