File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 2828/* VERSION is the current version of the data encrypted in the file */
2929#define VERSION ((u64)1)
3030
31+ /* How many peers do we send a backup to? */
32+ #define NUM_BACKUP_PEERS 2
33+
3134struct peer_backup {
3235 struct node_id peer ;
3336 /* Empty if it's a placeholder */
@@ -561,7 +564,7 @@ static struct command_result *send_to_peers(struct command *cmd)
561564 get_file_data (tmpctx , cmd -> plugin ));
562565
563566 * idx = 0 ;
564- for (peer = peer_map_first (cb -> peers , & it );
567+ for (peer = peer_map_pick (cb -> peers , pseudorand_u64 () , & it );
565568 peer ;
566569 peer = peer_map_next (cb -> peers , & it )) {
567570 struct info * info = tal (cmd , struct info );
@@ -579,6 +582,10 @@ static struct command_result *send_to_peers(struct command *cmd)
579582 json_add_hex_talarr (req -> js , "msg" , serialise_scb );
580583 (* info -> idx )++ ;
581584 send_outreq (req );
585+
586+ /* Only send to NUM_BACKUP_PEERS for each update */
587+ if (* info -> idx == NUM_BACKUP_PEERS )
588+ break ;
582589 }
583590
584591 if (* idx == 0 )
You can’t perform that action at this time.
0 commit comments