@@ -40,19 +40,19 @@ namespace feed::impl {
4040
4141void
4242ProposedTransactionFeed::ProposedTransactionSlot::operator ()(
43- AllVersionMsgsType const & allVersionMsgs
43+ AllVersionsMsgsPtrType const & allVersionMsgs
4444) const
4545{
46- if (auto connectionPtr = subscriptionContextWeakPtr .lock ()) {
47- if (feed .get ().notified_ .contains (connectionPtr.get ()))
46+ if (auto connectionPtr = subscriptionContextWeakPtr_ .lock ()) {
47+ if (feed_ .get ().notified_ .contains (connectionPtr.get ()))
4848 return ;
4949
50- feed .get ().notified_ .insert (connectionPtr.get ());
50+ feed_ .get ().notified_ .insert (connectionPtr.get ());
5151
5252 if (connectionPtr->apiSubversion () < 2u ) {
53- connectionPtr->send (allVersionMsgs[ 0 ] );
53+ connectionPtr->send (std::shared_ptr<std::string>( allVersionMsgs, &allVersionMsgs-> v1 ) );
5454 } else {
55- connectionPtr->send (allVersionMsgs[ 1 ] );
55+ connectionPtr->send (std::shared_ptr<std::string>( allVersionMsgs, &allVersionMsgs-> v2 ) );
5656 }
5757 }
5858}
@@ -107,11 +107,8 @@ ProposedTransactionFeed::unsub(
107107void
108108ProposedTransactionFeed::pub (boost::json::object const & receivedTxJson)
109109{
110- // v1: forward as-is (rippled sends "transaction" key)
111- auto const v1Msg = std::make_shared<std::string>(boost::json::serialize (receivedTxJson));
112-
113110 // v2: rename "transaction" → "tx_json", move "hash" to top level
114- auto const v2Msg = [&]() {
111+ auto const v2Json = [&]() {
115112 boost::json::object v2Json = receivedTxJson;
116113 if (v2Json.contains (JS (transaction))) {
117114 boost::json::value txVal = v2Json.at (JS (transaction));
@@ -125,10 +122,14 @@ ProposedTransactionFeed::pub(boost::json::object const& receivedTxJson)
125122 }
126123 v2Json[JS (tx_json)] = std::move (txVal);
127124 }
128- return std::make_shared<std::string>( boost::json::serialize ( v2Json)) ;
125+ return v2Json;
129126 }();
130127
131- AllVersionMsgsType const allVersionMsgs{v1Msg, v2Msg};
128+ auto const allVersionMsgs = std::make_shared<AllVersionMsgsType>(
129+ // v1: forward as-is (rippled sends "transaction" key)
130+ boost::json::serialize (receivedTxJson),
131+ boost::json::serialize (v2Json)
132+ );
132133
133134 auto const transaction = receivedTxJson.at (JS (transaction)).as_object ();
134135 auto const accounts = rpc::getAccountsFromTransaction (transaction);
0 commit comments