@@ -206,7 +206,7 @@ static void rebroadcast_txs(struct topology *topo, struct command *cmd)
206
206
struct txs_to_broadcast * txs ;
207
207
struct outgoing_tx * otx ;
208
208
209
- if (cmd -> dstate -> dev_no_broadcast )
209
+ if (topo -> dev_no_broadcast )
210
210
return ;
211
211
212
212
txs = tal (topo , struct txs_to_broadcast );
@@ -267,7 +267,7 @@ void broadcast_tx(struct topology *topo,
267
267
log_add_struct (topo -> bitcoind -> log ,
268
268
" (tx %s)" , struct sha256_double , & otx -> txid );
269
269
270
- if (peer -> dstate -> dev_no_broadcast )
270
+ if (topo -> dev_no_broadcast )
271
271
broadcast_done (topo -> bitcoind , 0 , "dev_no_broadcast" , otx );
272
272
else
273
273
bitcoind_sendrawtx (peer , topo -> bitcoind , otx -> hextx ,
@@ -488,8 +488,9 @@ struct txlocator *locate_tx(const void *ctx, const struct topology *topo,
488
488
return tal_free (loc );
489
489
}
490
490
491
- static void json_dev_broadcast (struct command * cmd ,
492
- const char * buffer , const jsmntok_t * params )
491
+ void json_dev_broadcast (struct command * cmd ,
492
+ struct topology * topo ,
493
+ const char * buffer , const jsmntok_t * params )
493
494
{
494
495
jsmntok_t * enabletok ;
495
496
bool enable ;
@@ -508,7 +509,7 @@ static void json_dev_broadcast(struct command *cmd,
508
509
509
510
log_debug (cmd -> dstate -> base_log , "dev-broadcast: broadcast %s" ,
510
511
enable ? "enabled" : "disabled" );
511
- cmd -> dstate -> dev_no_broadcast = !enable ;
512
+ cmd -> dstate -> topology -> dev_no_broadcast = !enable ;
512
513
513
514
/* If enabling, flush and wait. */
514
515
if (enable )
@@ -517,14 +518,6 @@ static void json_dev_broadcast(struct command *cmd,
517
518
command_success (cmd , null_response (cmd ));
518
519
}
519
520
520
- static const struct json_command dev_broadcast_command = {
521
- "dev-broadcast" ,
522
- json_dev_broadcast ,
523
- "Pretend we broadcast txs, but don't send to bitcoind" ,
524
- "Returns an empty result on success (waits for flush if enabled)"
525
- };
526
- AUTODATA (json_command , & dev_broadcast_command );
527
-
528
521
/* On shutdown, peers get deleted last. That frees from our list, so
529
522
* do it now instead. */
530
523
static void destroy_outgoing_txs (struct topology * topo )
@@ -543,6 +536,7 @@ struct topology *new_topology(const tal_t *ctx)
543
536
list_head_init (& topo -> outgoing_txs );
544
537
txwatch_hash_init (& topo -> txwatches );
545
538
txowatch_hash_init (& topo -> txowatches );
539
+ topo -> dev_no_broadcast = false;
546
540
547
541
return topo ;
548
542
}
0 commit comments