@@ -1577,8 +1577,8 @@ impl Relay {
1577
1577
1578
1578
negentropy. seal ( ) ?;
1579
1579
1580
- let id = SubscriptionId :: generate ( ) ;
1581
- let open_msg = ClientMessage :: neg_open ( & mut negentropy, & id , filter) ?;
1580
+ let sub_id = SubscriptionId :: generate ( ) ;
1581
+ let open_msg = ClientMessage :: neg_open ( & mut negentropy, & sub_id , filter) ?;
1582
1582
1583
1583
self . send_msg ( open_msg, Some ( Duration :: from_secs ( 10 ) ) )
1584
1584
. await ?;
@@ -1592,7 +1592,7 @@ impl Relay {
1592
1592
subscription_id,
1593
1593
message,
1594
1594
} => {
1595
- if subscription_id == id {
1595
+ if subscription_id == sub_id {
1596
1596
let query: Bytes = Bytes :: from_hex ( message) ?;
1597
1597
let mut need_ids: Vec < Bytes > = Vec :: new ( ) ;
1598
1598
let msg: Option < Bytes > = negentropy. reconcile_with_ids (
@@ -1601,14 +1601,24 @@ impl Relay {
1601
1601
& mut need_ids,
1602
1602
) ?;
1603
1603
1604
- // TODO: request ids to relay
1605
- println ! ( "IDs: {need_ids:?}" ) ;
1604
+ let ids: Vec < String > =
1605
+ need_ids. into_iter ( ) . map ( |id| id. to_hex ( ) ) . collect ( ) ;
1606
+ let filter = Filter :: new ( ) . ids ( ids) ;
1607
+ self . req_events_of (
1608
+ vec ! [ filter] ,
1609
+ Duration :: from_secs ( 120 ) ,
1610
+ FilterOptions :: ExitOnEOSE ,
1611
+ ) ;
1606
1612
1607
1613
match msg {
1608
1614
Some ( query) => {
1615
+ tracing:: info!(
1616
+ "Continue with reconciliation with {}" ,
1617
+ self . url
1618
+ ) ;
1609
1619
self . send_msg (
1610
1620
ClientMessage :: NegMsg {
1611
- subscription_id : id . clone ( ) ,
1621
+ subscription_id : sub_id . clone ( ) ,
1612
1622
message : query. to_hex ( ) ,
1613
1623
} ,
1614
1624
None ,
@@ -1626,7 +1636,7 @@ impl Relay {
1626
1636
subscription_id,
1627
1637
code,
1628
1638
} => {
1629
- if subscription_id == id {
1639
+ if subscription_id == sub_id {
1630
1640
tracing:: error!( "Negentropy syncing error: {code}" ) ;
1631
1641
break ;
1632
1642
}
0 commit comments