@@ -770,6 +770,7 @@ impl NotificationServiceApi for NotificationService {
770
770
Some ( rejected_action) ,
771
771
) ;
772
772
773
+ self . send_bill_chain_events ( event) . await ?;
773
774
self . send_all_bill_events ( & event. sender ( ) , & all_events)
774
775
. await ?;
775
776
// Only send email to holder (=requester)
@@ -1198,13 +1199,38 @@ mod tests {
1198
1199
. returning ( |_, _| Ok ( ( ) ) )
1199
1200
. times ( 3 ) ;
1200
1201
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
+
1201
1227
let service = NotificationService :: new (
1202
1228
vec ! [ Arc :: new( mock) ] ,
1203
1229
Arc :: new ( MockNotificationStore :: new ( ) ) ,
1204
1230
Arc :: new ( MockEmailNotificationStore :: new ( ) ) ,
1205
1231
Arc :: new ( mock_contact_service) ,
1206
1232
Arc :: new ( MockNostrQueuedMessageStore :: new ( ) ) ,
1207
- Arc :: new ( MockNostrChainEventStore :: new ( ) ) ,
1233
+ Arc :: new ( mock_event_store ) ,
1208
1234
Arc :: new ( MockEmailClient :: new ( ) ) ,
1209
1235
Arc :: new ( MockBillChainEventProcessorApi :: new ( ) ) ,
1210
1236
vec ! [ "ws://test.relay" . into( ) ] ,
0 commit comments