Fix: Duplicate messages when subscribe both accounts and proposed_accounts (#1415)

Fix #1134
This commit is contained in:
cyan317
2024-05-21 09:04:46 +01:00
committed by GitHub
parent 36c6caa7c0
commit df17b429c5
8 changed files with 386 additions and 4 deletions

View File

@@ -444,6 +444,22 @@ TEST_F(SubscriptionSourceReadTests, GotTransactionIsForwardingTrue)
ioContext_.run();
}
TEST_F(SubscriptionSourceReadTests, GotTransactionWithMetaIsForwardingFalse)
{
subscriptionSource_.setForwarding(true);
boost::json::object const message = {{"transaction", "some_transaction_data"}, {"meta", "some_meta_data"}};
boost::asio::spawn(ioContext_, [&message, this](boost::asio::yield_context yield) {
auto connection = connectAndSendMessage(boost::json::serialize(message), yield);
connection.close(yield);
});
EXPECT_CALL(onConnectHook_, Call());
EXPECT_CALL(onDisconnectHook_, Call()).WillOnce([this]() { subscriptionSource_.stop(); });
EXPECT_CALL(*subscriptionManager_, forwardProposedTransaction(message)).Times(0);
ioContext_.run();
}
TEST_F(SubscriptionSourceReadTests, GotValidationReceivedIsForwardingFalse)
{
boost::asio::spawn(ioContext_, [this](boost::asio::yield_context yield) {