@@ -770,6 +770,7 @@ impl NotificationServiceApi for NotificationService {
770770 Some ( rejected_action) ,
771771 ) ;
772772
773+ self . send_bill_chain_events ( event) . await ?;
773774 self . send_all_bill_events ( & event. sender ( ) , & all_events)
774775 . await ?;
775776 // Only send email to holder (=requester)
@@ -1198,13 +1199,38 @@ mod tests {
11981199 . returning ( |_, _| Ok ( ( ) ) )
11991200 . times ( 3 ) ;
12001201
1202+ let previous_hash = chain. get_latest_block ( ) . previous_hash . to_owned ( ) ;
1203+ let mut mock_event_store = MockNostrChainEventStore :: new ( ) ;
1204+ // lookup parent event
1205+ mock_event_store
1206+ . expect_find_by_block_hash ( )
1207+ . with ( eq ( previous_hash. to_owned ( ) ) )
1208+ . returning ( |_| Ok ( None ) ) ;
1209+
1210+ // sends the public chain event for each of the events
1211+ mock. expect_send_public_chain_event ( )
1212+ . returning ( |_, _, _, _, _, _, _| Ok ( get_test_nostr_event ( ) ) )
1213+ . times ( 4 ) ;
1214+
1215+ // afterwards we store the block event we have sent
1216+ mock_event_store
1217+ . expect_add_chain_event ( )
1218+ . returning ( |_| Ok ( ( ) ) )
1219+ . times ( 4 ) ;
1220+
1221+ // this is only required for the test as it contains an invite block so it tries to send an
1222+ // invite to new participants as well and the test data doesn't have them all.
1223+ mock. expect_send_private_event ( )
1224+ . withf ( |_, e| e. event_type == EventType :: BillChainInvite )
1225+ . returning ( |_, _| Ok ( ( ) ) ) ;
1226+
12011227 let service = NotificationService :: new (
12021228 vec ! [ Arc :: new( mock) ] ,
12031229 Arc :: new ( MockNotificationStore :: new ( ) ) ,
12041230 Arc :: new ( MockEmailNotificationStore :: new ( ) ) ,
12051231 Arc :: new ( mock_contact_service) ,
12061232 Arc :: new ( MockNostrQueuedMessageStore :: new ( ) ) ,
1207- Arc :: new ( MockNostrChainEventStore :: new ( ) ) ,
1233+ Arc :: new ( mock_event_store ) ,
12081234 Arc :: new ( MockEmailClient :: new ( ) ) ,
12091235 Arc :: new ( MockBillChainEventProcessorApi :: new ( ) ) ,
12101236 vec ! [ "ws://test.relay" . into( ) ] ,
0 commit comments