@@ -480,7 +480,6 @@ int main(int argc, char *argv[])
480
480
bool setup = false;
481
481
struct thash thash ;
482
482
int fd ;
483
- unsigned int known_txs = 0 ;
484
483
485
484
err_set_progname (argv [0 ]);
486
485
@@ -520,11 +519,11 @@ int main(int argc, char *argv[])
520
519
const jsmntok_t * t , * end ;
521
520
const char * buffer ;
522
521
const tal_t * this_ctx = tal (ctx , char );
523
- char * fromstr = tal_fmt (this_ctx , "%u" , known_txs );
524
522
523
+ /* FIXME: We should just get the latest, not all. */
525
524
toks = json_bitcoind (this_ctx , & buffer ,
526
525
"listtransactions" , "gateway" ,
527
- "999999" , fromstr );
526
+ "999999" , NULL );
528
527
529
528
if (!toks )
530
529
err (1 , "Asking bitcoind for transactions" );
@@ -558,14 +557,16 @@ int main(int argc, char *argv[])
558
557
errx (1 , "Unexpected type in"
559
558
" listtransactions array" );
560
559
560
+ /* Ignore transactions we sent. */
561
+ val = json_get_member (buffer , t , "category" );
562
+ if (!json_tok_streq (buffer , val , "receive" ))
563
+ continue ;
564
+
561
565
/* Not enough confirmations? Stop here. */
562
566
val = json_get_member (buffer , t , "confirmations" );
563
567
if (num_of (buffer , val ) < REQUIRED_CONFIRMATIONS )
564
568
break ;
565
569
566
- /* Next time, don't need this tx. */
567
- known_txs ++ ;
568
-
569
570
val = json_get_member (buffer , t , "txid" );
570
571
if (!val )
571
572
errx (1 , "No txid in '%s'" , buffer );
0 commit comments