rapid-gossip-sync-server
9 months agoCorrect upgrade logic to ignore missing indexes 2023-07-further-opt
Matt Corallo [Sun, 16 Jul 2023 17:25:10 +0000 (17:25 +0000)]
Correct upgrade logic to ignore missing indexes

If we upgrade multiple versions in one go, the indexes we're trying
to drop may not exist, and that shouldn't cause us to fail to
upgrade.

9 months agoDrop overly optimistic index
Matt Corallo [Sun, 16 Jul 2023 17:20:56 +0000 (17:20 +0000)]
Drop overly optimistic index

The `channel_updates_id_with_scid_dir_blob` index allows the
intermediate-row-fetching logic to be index-only, but there's very
little reason to do so - we now use subqueries to build the exact
set of rows we want, by id, and then fetch various colums. Having
an index that lets us look up those columns without hitting the
regular table is fine, but there's not a ton of cost to hitting the
table by primary key and maintaining yet another index isn't free.

9 months agoFurther optimize intermediate row fetching by filtering scids first
Matt Corallo [Sun, 16 Jul 2023 17:13:10 +0000 (17:13 +0000)]
Further optimize intermediate row fetching by filtering scids first

Postgresql actually thinks this version is more expensive, but when
I run it its about 4x as fast:

```
ln-gossip=# EXPLAIN ANALYZE SELECT id, direction, blob_signed FROM channel_updates
    WHERE id IN (
        SELECT DISTINCT ON (short_channel_id, direction) id
        FROM channel_updates
        WHERE seen < '2023-07-08 00:00:00' AND short_channel_id IN (
            SELECT DISTINCT ON (short_channel_id) short_channel_id
            FROM channel_updates
            WHERE seen >= '2023-07-08 00:00:00'
        )
        ORDER BY short_channel_id ASC, direction ASC, seen DESC
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Nested Loop  (cost=3771382.74..3772300.66 rows=172186 width=145) (actual time=25270.727..34954.993 rows=129921 loops=1)
   ->  HashAggregate  (cost=3771382.18..3771384.18 rows=200 width=4) (actual time=25267.060..25313.378 rows=129921 loops=1)
         Group Key: channel_updates_1.id
         Batches: 1  Memory Usage: 12321kB
         ->  Unique  (cost=189510.13..3769229.85 rows=172186 width=21) (actual time=693.154..25177.896 rows=129921 loops=1)
               ->  Merge Join  (cost=189510.13..3480148.53 rows=57816264 width=21) (actual time=693.152..23970.052 rows=31781122 loops=1)
                     Merge Cond: (channel_updates_1.short_channel_id = channel_updates_2.short_channel_id)
                     ->  Index Only Scan using channel_updates_scid_dir_seen_desc_with_id on channel_updates channel_updates_1  (cost=0.56..2560497.30 rows=57816264 width=21) (actual time=0.154..19198.277 rows=57605314 loops=1)
                           Index Cond: (seen < '2023-07-08 00:00:00'::timestamp without time zone)
                           Heap Fetches: 0
                     ->  Unique  (cost=189509.57..195871.76 rows=86093 width=8) (actual time=594.634..787.364 rows=68181 loops=1)
                           ->  Sort  (cost=189509.57..192690.67 rows=1272439 width=8) (actual time=594.621..722.739 rows=1452420 loops=1)
                                 Sort Key: channel_updates_2.short_channel_id
                                 Sort Method: external merge  Disk: 17664kB
                                 ->  Index Only Scan using channel_updates_seen_scid on channel_updates channel_updates_2  (cost=0.56..43091.07 rows=1272439 width=8) (actual time=3.461..348.146 rows=1502697 loops=1)
                                       Index Cond: (seen >= '2023-07-08 00:00:00'::timestamp without time zone)
                                       Heap Fetches: 40000
   ->  Index Only Scan using channel_updates_id_with_scid_dir_blob on channel_updates  (cost=0.56..4.60 rows=1 width=145) (actual time=0.074..0.074 rows=1 loops=129921)
         Index Cond: (id = channel_updates_1.id)
         Heap Fetches: 0
 Planning Time: 20.757 ms
 JIT:
   Functions: 18
   Options: Inlining true, Optimization true, Expressions true, Deforming true
   Timing: Generation 0.770 ms, Inlining 51.503 ms, Optimization 25.848 ms, Emission 21.086 ms, Total 99.208 ms
 Execution Time: 34995.683 ms
(26 rows)

ln-gossip=# EXPLAIN ANALYZE SELECT id, direction, blob_signed FROM channel_updates
    WHERE id IN (
        SELECT DISTINCT ON (short_channel_id, direction) id
        FROM channel_updates
        WHERE seen < '2023-07-08 00:00:00'
        ORDER BY short_channel_id ASC, direction ASC, seen DESC
    ) AND short_channel_id IN (
        SELECT DISTINCT ON (short_channel_id) short_channel_id
        FROM channel_updates
        WHERE seen >= '2023-07-08 00:00:00'
    );
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Hash Join  (cost=3049540.37..3050910.30 rows=172186 width=145) (actual time=18697.102..123187.066 rows=129921 loops=1)
   Hash Cond: (channel_updates.short_channel_id = channel_updates_2.short_channel_id)
   ->  Nested Loop  (cost=2851731.51..2852649.44 rows=172186 width=153) (actual time=18029.529..122265.952 rows=393938 loops=1)
         ->  HashAggregate  (cost=2851730.95..2851732.95 rows=200 width=4) (actual time=18027.857..18309.986 rows=393938 loops=1)
               Group Key: channel_updates_1.id
               Batches: 5  Memory Usage: 16449kB  Disk Usage: 7104kB
               ->  Result  (cost=0.56..2849578.62 rows=172186 width=21) (actual time=0.070..17851.034 rows=393938 loops=1)
                     ->  Unique  (cost=0.56..2849578.62 rows=172186 width=21) (actual time=0.044..17809.361 rows=393938 loops=1)
                           ->  Index Only Scan using channel_updates_scid_dir_seen_desc_with_id on channel_updates channel_updates_1  (cost=0.56..2560497.30 rows=57816264 width=21) (actual time=0.043..15596.783 rows=57605314 loops=1)
                                 Index Cond: (seen < '2023-07-08 00:00:00'::timestamp without time zone)
                                 Heap Fetches: 0
         ->  Index Only Scan using channel_updates_id_with_scid_dir_blob on channel_updates  (cost=0.56..4.60 rows=1 width=153) (actual time=0.263..0.263 rows=1 loops=393938)
               Index Cond: (id = channel_updates_1.id)
               Heap Fetches: 0
   ->  Hash  (cost=196732.69..196732.69 rows=86093 width=8) (actual time=662.832..662.833 rows=70509 loops=1)
         Buckets: 131072  Batches: 1  Memory Usage: 3779kB
         ->  Unique  (cost=189509.57..195871.76 rows=86093 width=8) (actual time=542.007..657.269 rows=70509 loops=1)
               ->  Sort  (cost=189509.57..192690.67 rows=1272439 width=8) (actual time=542.004..610.886 rows=1502697 loops=1)
                     Sort Key: channel_updates_2.short_channel_id
                     Sort Method: external merge  Disk: 17664kB
                     ->  Index Only Scan using channel_updates_seen_scid on channel_updates channel_updates_2  (cost=0.56..43091.07 rows=1272439 width=8) (actual time=67.791..274.989 rows=1502697 loops=1)
                           Index Cond: (seen >= '2023-07-08 00:00:00'::timestamp without time zone)
                           Heap Fetches: 39999
 Planning Time: 0.324 ms
 JIT:
   Functions: 23
   Options: Inlining true, Optimization true, Expressions true, Deforming true
   Timing: Generation 0.976 ms, Inlining 8.080 ms, Optimization 37.602 ms, Emission 26.389 ms, Total 73.048 ms
 Execution Time: 123206.373 ms
(29 rows)
```

9 months agoEnforce panic = abort in all build modes
Matt Corallo [Sun, 16 Jul 2023 03:24:53 +0000 (03:24 +0000)]
Enforce panic = abort in all build modes

9 months agoUpgrade to LDK 0.0.116-alpha1
Matt Corallo [Sun, 16 Jul 2023 03:23:34 +0000 (03:23 +0000)]
Upgrade to LDK 0.0.116-alpha1

This includes a fix for the deadlock in #32.

9 months agoDon't hold the `NetworkGraph` read lock across an await point
Matt Corallo [Sun, 16 Jul 2023 03:20:52 +0000 (03:20 +0000)]
Don't hold the `NetworkGraph` read lock across an await point

Holding the `NetworkGraph` read lock across a query await point
can cause a deadlock if another task tries to handle a gossip
message at the same time.

9 months agoSwitch to streaming queries
Matt Corallo [Sun, 16 Jul 2023 00:37:05 +0000 (00:37 +0000)]
Switch to streaming queries

In order to use streaming queries we have to use `tokio-postgres`'s
`query_raw` command, rather than `query`. This should reduce our
memory footprint from 10+GB to well under one.

9 months agoBump tokio to latest LTS version now that we have a higher MSRV.
Matt Corallo [Sun, 16 Jul 2023 00:34:55 +0000 (00:34 +0000)]
Bump tokio to latest LTS version now that we have a higher MSRV.

9 months agoSwitch to Rust edition 2021
Matt Corallo [Sun, 16 Jul 2023 00:32:01 +0000 (00:32 +0000)]
Switch to Rust edition 2021

This increases the MSRV to 1.56, which is now almost two years old,
and lets us use array::IntoIter in the next commit.

9 months agoRemove unused `consider_intermediate_updates` flag..optimizing query
Matt Corallo [Sat, 15 Jul 2023 07:01:16 +0000 (07:01 +0000)]
Remove unused `consider_intermediate_updates` flag..optimizing query

The `consider_intermediate_updates` flag is always set, and must be
set for correctness, so we remove it. Further, we optimize the
query that hung on it somewhat by removing an uneccessary
`ORDER BY` clause which was only neccessary if
`consider_intermediate_updates` were unset.

9 months agoSubstantially optimize reference-row-fetching
Matt Corallo [Sat, 15 Jul 2023 06:42:33 +0000 (06:42 +0000)]
Substantially optimize reference-row-fetching

By first fetching the rows we need from a smaller index, we avoid
walking a large index which contained the full `blob_signed`. This
reduces reference-row-fetching from 680 seconds to 152 seconds when
searching today for reference rows against 7 days ago.

Old:

```
ln-gossip=# EXPLAIN ANALYZE SELECT DISTINCT ON (short_channel_id, direction) id, blob_signed, direction
        FROM channel_updates
        WHERE seen < '2023-07-07 00:00:00' AND short_channel_id IN (
            SELECT DISTINCT ON (short_channel_id) short_channel_id
            FROM channel_updates
            WHERE seen >= '2023-07-07 00:00:00'
        )
        ORDER BY short_channel_id ASC, direction ASC, seen DESC;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Unique  (cost=186279.46..11921204.82 rows=168910 width=161) (actual time=732.365..680504.173 rows=129985 loops=1)
   ->  Merge Join  (cost=186279.46..11632998.93 rows=57641177 width=161) (actual time=732.364..679193.755 rows=31714061 loops=1)
         Merge Cond: (channel_updates.short_channel_id = channel_updates_1.short_channel_id)
         ->  Index Only Scan using channel_updates_scid_dir_seen on channel_updates  (cost=0.56..10718853.69 rows=57641177 width=161) (actual time=0.638..673675.749 rows=57408667 loops=1)
               Index Cond: (seen < '2023-07-07 00:00:00'::timestamp without time zone)
               Heap Fetches: 0
         ->  Unique  (cost=186278.90..192574.84 rows=84455 width=8) (actual time=478.881..750.241 rows=68210 loops=1)
               ->  Sort  (cost=186278.90..189426.87 rows=1259188 width=8) (actual time=478.878..653.035 rows=1452661 loops=1)
                     Sort Key: channel_updates_1.short_channel_id
                     Sort Method: external merge  Disk: 17680kB
                     ->  Index Only Scan using channel_updates_seen_scid on channel_updates channel_updates_1  (cost=0.56..41481.08 rows=1259188 width=8) (actual time=0.885..264.333 rows=1504495 loops=1)
                           Index Cond: (seen >= '2023-07-07 00:00:00'::timestamp without time zone)
                           Heap Fetches: 2273
 Planning Time: 0.164 ms
 JIT:
   Functions: 9
   Options: Inlining true, Optimization true, Expressions true, Deforming true
   Timing: Generation 21.265 ms, Inlining 37.914 ms, Optimization 113.040 ms, Emission 101.901 ms, Total 274.121 ms
 Execution Time: 680601.155 ms
(19 rows)
```

New:

```
ln-gossip=# EXPLAIN ANALYZE SELECT id, direction, blob_signed FROM channel_updates
    WHERE id IN (
        SELECT DISTINCT ON (short_channel_id, direction) id
        FROM channel_updates
        WHERE seen < '2023-07-07 00:00:00'
        ORDER BY short_channel_id ASC, direction ASC, seen DESC
    ) AND short_channel_id IN (
        SELECT DISTINCT ON (short_channel_id) short_channel_id
        FROM channel_updates
        WHERE seen >= '2023-07-07 00:00:00'
    );
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Hash Join  (cost=2942503.92..2943867.77 rows=169870 width=145) (actual time=22862.627..152436.685 rows=130116 loops=1)
   Hash Cond: (channel_updates.short_channel_id = channel_updates_2.short_channel_id)
   ->  Nested Loop  (cost=2738282.26..2739200.18 rows=169870 width=153) (actual time=22141.452..151504.140 rows=393250 loops=1)
         ->  HashAggregate  (cost=2738281.69..2738283.69 rows=200 width=4) (actual time=22139.440..22339.035 rows=393250 loops=1)
               Group Key: channel_updates_1.id
               Batches: 1  Memory Usage: 45089kB
               ->  Result  (cost=0.56..2736158.32 rows=169870 width=21) (actual time=0.102..21984.409 rows=393250 loops=1)
                     ->  Unique  (cost=0.56..2736158.32 rows=169870 width=21) (actual time=0.074..21943.089 rows=393250 loops=1)
                           ->  Index Only Scan using channel_updates_scid_dir_seen_desc_with_id on channel_updates channel_updates_1  (cost=0.56..2448011.03 rows=57629457 width=21) (actual time=0.073..19776.181 rows=57408667 loops=1)
                                 Index Cond: (seen < '2023-07-07 00:00:00'::timestamp without time zone)
                                 Heap Fetches: 0
         ->  Index Only Scan using channel_updates_id_with_scid_dir_blob on channel_updates  (cost=0.56..4.60 rows=1 width=153) (actual time=0.328..0.328 rows=1 loops=393250)
               Index Cond: (id = channel_updates_1.id)
               Heap Fetches: 0
   ->  Hash  (cost=203159.97..203159.97 rows=84935 width=8) (actual time=721.105..721.107 rows=70731 loops=1)
         Buckets: 131072  Batches: 1  Memory Usage: 3787kB
         ->  Unique  (cost=195708.67..202310.62 rows=84935 width=8) (actual time=552.965..713.465 rows=70731 loops=1)
               ->  Sort  (cost=195708.67..199009.65 rows=1320391 width=8) (actual time=552.962..650.323 rows=1537141 loops=1)
                     Sort Key: channel_updates_2.short_channel_id
                     Sort Method: external merge  Disk: 18064kB
                     ->  Index Only Scan using channel_updates_seen_scid on channel_updates channel_updates_2  (cost=0.56..43421.19 rows=1320391 width=8) (actual time=66.736..324.130 rows=1537141 loops=1)
                           Index Cond: (seen >= '2023-07-07 00:00:00'::timestamp without time zone)
                           Heap Fetches: 68
 Planning Time: 0.520 ms
 JIT:
   Functions: 21
   Options: Inlining true, Optimization true, Expressions true, Deforming true
   Timing: Generation 0.643 ms, Inlining 7.055 ms, Optimization 33.167 ms, Emission 25.782 ms, Total 66.648 ms
 Execution Time: 152458.777 ms
(29 rows)
```

9 months agoMerge pull request #43 from TheBlueMatt/main
Arik [Mon, 10 Jul 2023 18:11:00 +0000 (11:11 -0700)]
Merge pull request #43 from TheBlueMatt/main

Require DB insertions to complete in five seconds

9 months agoRequire DB insertions to complete in fifteen seconds
Matt Corallo [Thu, 6 Jul 2023 16:43:05 +0000 (16:43 +0000)]
Require DB insertions to complete in fifteen seconds

For some reason the mainnet server hung, seemingly on the DB
insertion task. This will improve debugging by simply crashing if
an insertion takes longer than five seconds.

9 months agoMerge pull request #42 from TheBlueMatt/main
Arik [Sun, 2 Jul 2023 19:43:01 +0000 (12:43 -0700)]
Merge pull request #42 from TheBlueMatt/main

#39 Followups

9 months agoRedo indexes for new SELECTs and trivially tweak one old query
Matt Corallo [Sun, 2 Jul 2023 18:45:10 +0000 (18:45 +0000)]
Redo indexes for new SELECTs and trivially tweak one old query

9 months agoBuild reminder updates with correct SCID field
Matt Corallo [Sun, 2 Jul 2023 17:17:07 +0000 (17:17 +0000)]
Build reminder updates with correct SCID field

When the reminder updates were added, a dummy `ChannelUpdate` with
a number of zero'd fields were created under the assumption that
the zero'd fields would be ignored downstream when building
serialized updates. However, the SCID field was `assert`'ed on (and
serialized in the update), causing any reminder updates to cause an
assertion panic.

Instead, we do it the Right Way (tm) here and move the
only-sometimes-available fields into the update type enum, ensuring
we can't access "poison" fields downstream.

9 months agoLet postgres filter timestamps rather than doing it in Rust
Matt Corallo [Sun, 2 Jul 2023 16:12:25 +0000 (16:12 +0000)]
Let postgres filter timestamps rather than doing it in Rust

9 months agoFix query compat with Postgres 13
Matt Corallo [Sun, 2 Jul 2023 16:13:26 +0000 (16:13 +0000)]
Fix query compat with Postgres 13

...which requires DISTINCT ON to match the start of ORDER BY.

9 months agoClean up SQL query formatting to make them somewhat more readable
Matt Corallo [Sun, 2 Jul 2023 17:39:35 +0000 (17:39 +0000)]
Clean up SQL query formatting to make them somewhat more readable

10 months agoReduce data loaded from the `channel_update` table when not needed
Matt Corallo [Sun, 2 Jul 2023 16:02:11 +0000 (16:02 +0000)]
Reduce data loaded from the `channel_update` table when not needed

10 months agoMerge pull request #39 from arik-so/2023-06-announcement_inclusion_fixes
Matt Corallo [Sun, 2 Jul 2023 15:52:53 +0000 (15:52 +0000)]
Merge pull request #39 from arik-so/2023-06-announcement_inclusion_fixes

Announcement inclusion fixes & reminders

10 months agoMerge pull request #40 from arik-so/2023-06-0.0.115
Matt Corallo [Wed, 28 Jun 2023 15:03:27 +0000 (15:03 +0000)]
Merge pull request #40 from arik-so/2023-06-0.0.115

Update lightning to 0.0.115

10 months agoOmit reminders for channels with incomplete data.
Arik Sosman [Tue, 27 Jun 2023 20:56:56 +0000 (16:56 -0400)]
Omit reminders for channels with incomplete data.

10 months agoCreate dummy flags without secondary lookup query.
Arik Sosman [Tue, 27 Jun 2023 20:51:56 +0000 (16:51 -0400)]
Create dummy flags without secondary lookup query.

10 months agoSend reminders for stale-ish channels.
Arik Sosman [Tue, 27 Jun 2023 19:58:12 +0000 (15:58 -0400)]
Send reminders for stale-ish channels.

10 months agoFix first update lookup.
Arik Sosman [Tue, 27 Jun 2023 19:57:37 +0000 (15:57 -0400)]
Fix first update lookup.

10 months agoUpdate to 0.0.115.
Arik Sosman [Tue, 27 Jun 2023 20:26:15 +0000 (16:26 -0400)]
Update to 0.0.115.

10 months agoMerge pull request #38 from TheBlueMatt/main
Matt Corallo [Mon, 12 Jun 2023 18:19:58 +0000 (18:19 +0000)]
Merge pull request #38 from TheBlueMatt/main

Removed unused_mut rejection and fix some unused `mut`s

10 months agoRemoved unused_mut rejection and fix some unused `mut`s
Matt Corallo [Mon, 5 Jun 2023 23:26:38 +0000 (23:26 +0000)]
Removed unused_mut rejection and fix some unused `mut`s

Making warnings a hard failure is generally bad practice as it can
result in new compiler versions failing to compile
otherwise-totally-acceptable code, which in this case is happening
on rustc beta, which is now warning for new cases of unused mut.

10 months agoMerge pull request #37 from marctyndel/configurable-caches-path
Matt Corallo [Mon, 5 Jun 2023 23:24:38 +0000 (23:24 +0000)]
Merge pull request #37 from marctyndel/configurable-caches-path

optionally set path for caches from env

10 months agoquick fix to be able to set the caches path via env variables like we do for the...
Marc Tyndel [Mon, 5 Jun 2023 17:54:51 +0000 (13:54 -0400)]
quick fix to be able to set the caches path via env variables like we do for the DB and bitcoind configuration

11 months agoMerge pull request #35 from andrei-21/fix/dummy-symlink
Matt Corallo [Tue, 16 May 2023 19:34:20 +0000 (19:34 +0000)]
Merge pull request #35 from andrei-21/fix/dummy-symlink

Fix dummy symlink

11 months agoFix dummy symlink
Andrei [Tue, 16 May 2023 00:00:00 +0000 (00:00 +0000)]
Fix dummy symlink

The commit changes the symlink for the snapshot for the current date
from `./res/snapshots_pending/empty_delta.lngossip` to
`../snapshots/empty_delta.lngossip` such that nginx does not
retrun 404, but 200 with the dummy snapshot

11 months agoMerge pull request #29 from arik-so/2023-04-empty-blob-generator
Matt Corallo [Sat, 6 May 2023 23:57:09 +0000 (23:57 +0000)]
Merge pull request #29 from arik-so/2023-04-empty-blob-generator

Create a utility method to generate noöp RGS blobs.

11 months agoCreate a utility method to generate noöp RGS blobs.
Arik Sosman [Tue, 4 Apr 2023 23:20:58 +0000 (16:20 -0700)]
Create a utility method to generate noöp RGS blobs.

12 months agoMerge pull request #31 from benthecarman/ignore-cargo-lock
Matt Corallo [Mon, 24 Apr 2023 17:34:22 +0000 (17:34 +0000)]
Merge pull request #31 from benthecarman/ignore-cargo-lock

Include Cargo.lock file

12 months agoRemove need to pin deps
benthecarman [Sat, 15 Apr 2023 19:30:31 +0000 (14:30 -0500)]
Remove need to pin deps

12 months agoMerge pull request #21 from jurvis/jurvis/2022-11-rgs-docker-compose
Matt Corallo [Mon, 3 Apr 2023 23:12:32 +0000 (23:12 +0000)]
Merge pull request #21 from jurvis/jurvis/2022-11-rgs-docker-compose

Create a docker-compose for running an RGS server

13 months agoMerge pull request #25 from TheBlueMatt/main
Arik [Sat, 18 Mar 2023 13:56:29 +0000 (06:56 -0700)]
Merge pull request #25 from TheBlueMatt/main

Update to LDK 0.0.114

13 months agoWrite an `update_time.txt` file out to make monitoring simpler
Matt Corallo [Wed, 15 Mar 2023 17:52:13 +0000 (17:52 +0000)]
Write an `update_time.txt` file out to make monitoring simpler

13 months agoDelay prior to reconnecting peers that have disconnected
Matt Corallo [Tue, 28 Feb 2023 18:14:22 +0000 (18:14 +0000)]
Delay prior to reconnecting peers that have disconnected

13 months agoCall `PeerManager::timer_tick_occurred` regularly to ping peers
Matt Corallo [Wed, 8 Feb 2023 16:59:09 +0000 (16:59 +0000)]
Call `PeerManager::timer_tick_occurred` regularly to ping peers

13 months agoUpgrade to latest lightning crate, switching to async chain resolution
Matt Corallo [Wed, 8 Feb 2023 16:58:06 +0000 (16:58 +0000)]
Upgrade to latest lightning crate, switching to async chain resolution

13 months agoStop pruning the network graph on startup
Matt Corallo [Wed, 8 Feb 2023 16:55:23 +0000 (16:55 +0000)]
Stop pruning the network graph on startup

There's not a lot of reason for this and better to keep things
around until we go to build the gossip output

14 months agoMerge pull request #26 from andrei-21/feature/configure-network
Matt Corallo [Thu, 9 Feb 2023 00:08:30 +0000 (00:08 +0000)]
Merge pull request #26 from andrei-21/feature/configure-network

14 months agoMerge pull request #24 from andrei-21/feature/configure-peers
Arik [Wed, 8 Feb 2023 17:27:52 +0000 (09:27 -0800)]
Merge pull request #24 from andrei-21/feature/configure-peers

Make ln peers configurable

14 months agoLowercase network values
Andrei [Wed, 8 Feb 2023 00:00:00 +0000 (00:00 +0000)]
Lowercase network values

14 months agoMake ln peers configurable
Andrei [Wed, 8 Feb 2023 00:00:00 +0000 (00:00 +0000)]
Make ln peers configurable

14 months agoConfigure network
Andrei [Wed, 8 Feb 2023 00:00:00 +0000 (00:00 +0000)]
Configure network

17 months agoCreate simple docker-compose for testnet
Jurvis Tan [Tue, 15 Nov 2022 03:59:17 +0000 (19:59 -0800)]
Create simple docker-compose for testnet

17 months agoMerge pull request #19 from TheBlueMatt/main
Matt Corallo [Tue, 8 Nov 2022 19:00:42 +0000 (19:00 +0000)]
Merge pull request #19 from TheBlueMatt/main

Update LDK to 0.0.112 and workaround Postgres being broken

17 months agoPin once_cell to 1.14 to fix MSRV
Matt Corallo [Tue, 8 Nov 2022 01:06:51 +0000 (01:06 +0000)]
Pin once_cell to 1.14 to fix MSRV

17 months agoSet per-table autovacuum thresholds low
Matt Corallo [Tue, 8 Nov 2022 00:53:41 +0000 (00:53 +0000)]
Set per-table autovacuum thresholds low

Fixes #20

18 months agoPrune the network graph immediately prior to generating updates
Matt Corallo [Thu, 27 Oct 2022 18:01:44 +0000 (18:01 +0000)]
Prune the network graph immediately prior to generating updates

18 months agoUpdate LDK to 0.0.112
Matt Corallo [Thu, 27 Oct 2022 18:01:37 +0000 (18:01 +0000)]
Update LDK to 0.0.112

19 months agoMerge pull request #14 from TheBlueMatt/main
Arik [Wed, 14 Sep 2022 20:32:19 +0000 (13:32 -0700)]
Merge pull request #14 from TheBlueMatt/main

Upgrade to LDK 0.0.111, Improve SQL Types

19 months agoAdd one additional index which postgres prefers as the DB fills
Matt Corallo [Wed, 14 Sep 2022 20:12:17 +0000 (20:12 +0000)]
Add one additional index which postgres prefers as the DB fills

If postgres decides walking the full `channel_updates_scid_dir_seen`
index and removing old `seen` values is slower than just walking
the full table (or this new index) it does so. Sadly this causes
re-sorting (usually on-disk), but there doesn't seem to be a way to
avoid this.

19 months agoDrop useless indexes, add (very) useful indxes after benchmarking
Matt Corallo [Wed, 14 Sep 2022 19:22:49 +0000 (19:22 +0000)]
Drop useless indexes, add (very) useful indxes after benchmarking

19 months agoDrop unused columns from SELECT queries
Matt Corallo [Tue, 13 Sep 2022 15:48:31 +0000 (15:48 +0000)]
Drop unused columns from SELECT queries

19 months agoDrop the composite_index in favor of a multi-column unique index
Matt Corallo [Tue, 13 Sep 2022 15:43:53 +0000 (15:43 +0000)]
Drop the composite_index in favor of a multi-column unique index

Also set all the channel_update fields to NOT NULL, because they
should be non-null always.

19 months agoAdd some further indexes on channel_updates to match queries
Matt Corallo [Tue, 13 Sep 2022 00:07:49 +0000 (00:07 +0000)]
Add some further indexes on channel_updates to match queries

19 months agoDrop redundant block_height column on announcements, use i16 for flags
Matt Corallo [Tue, 13 Sep 2022 15:33:41 +0000 (15:33 +0000)]
Drop redundant block_height column on announcements, use i16 for flags

19 months agoSimplify composite index construction somewhat
Matt Corallo [Mon, 12 Sep 2022 04:21:24 +0000 (04:21 +0000)]
Simplify composite index construction somewhat

19 months agoUpdate to LDK 0.0.111, rust-bitcoin 0.29
Matt Corallo [Sun, 11 Sep 2022 22:39:59 +0000 (22:39 +0000)]
Update to LDK 0.0.111, rust-bitcoin 0.29

19 months agoUse more appropriate data types for SCIDs, direction, composite_index
Matt Corallo [Sun, 11 Sep 2022 21:06:34 +0000 (21:06 +0000)]
Use more appropriate data types for SCIDs, direction, composite_index

19 months agoDrop the chain_hash column
Matt Corallo [Sun, 11 Sep 2022 21:07:57 +0000 (21:07 +0000)]
Drop the chain_hash column

19 months agoAdd upgrade query support
Matt Corallo [Sun, 11 Sep 2022 16:41:12 +0000 (16:41 +0000)]
Add upgrade query support

19 months agoDrop several unused dependencies
Matt Corallo [Sun, 11 Sep 2022 18:14:32 +0000 (18:14 +0000)]
Drop several unused dependencies

20 months agoMerge pull request #13 from arik-so/2022-08-envvar-renaming
Matt Corallo [Tue, 23 Aug 2022 04:07:31 +0000 (04:07 +0000)]
Merge pull request #13 from arik-so/2022-08-envvar-renaming

20 months agoChange bitcoin REST endpoint default port to the standard mainnet default.
Arik Sosman [Tue, 23 Aug 2022 03:21:11 +0000 (20:21 -0700)]
Change bitcoin REST endpoint default port to the standard mainnet default.

20 months agoMerge pull request #11 from arik-so/2022-08-envvar-renaming
Matt Corallo [Tue, 23 Aug 2022 03:08:12 +0000 (03:08 +0000)]
Merge pull request #11 from arik-so/2022-08-envvar-renaming

Rename environment variables to reflect the name of this project.

20 months agoRename environment variables to reflect the name of this project.
Arik Sosman [Tue, 23 Aug 2022 00:46:14 +0000 (17:46 -0700)]
Rename environment variables to reflect the name of this project.

20 months agoMerge pull request #10 from TheBlueMatt/2022-08-no-pin-cpufeatures
Arik [Tue, 23 Aug 2022 00:37:53 +0000 (17:37 -0700)]
Merge pull request #10 from TheBlueMatt/2022-08-no-pin-cpufeatures

Skip pinning cpufeatures, which has fixed its MSRV

20 months agoMerge pull request #7 from TheBlueMatt/2022-08-fix-deadlock
Arik [Tue, 23 Aug 2022 00:36:53 +0000 (17:36 -0700)]
Merge pull request #7 from TheBlueMatt/2022-08-fix-deadlock

Fix Counter Lock Deadlock, Further Cleanups

20 months agoDrop spurious comments 2022-08-fix-deadlock
Matt Corallo [Mon, 22 Aug 2022 04:19:52 +0000 (04:19 +0000)]
Drop spurious comments

20 months agoDon't hold the counter lock while verifying gossip/waiting on DB
Matt Corallo [Mon, 22 Aug 2022 04:14:24 +0000 (04:14 +0000)]
Don't hold the counter lock while verifying gossip/waiting on DB

This resolves a deadlock if we block on the DB where we have one
thread blocked waiting on DB in a blocking thread, and the tokio
reactor blocked waiting on the counter lock which the blocking
thread holds.

20 months agoRemove unused fields and function in lib.rs
Matt Corallo [Mon, 22 Aug 2022 03:46:49 +0000 (03:46 +0000)]
Remove unused fields and function in lib.rs

20 months agoRemove indirection in initial sync completion
Matt Corallo [Mon, 22 Aug 2022 03:37:49 +0000 (03:37 +0000)]
Remove indirection in initial sync completion

Rather than sending a GossipMessage::InitialSyncComplete, which
causes the persistence logic to push to another queue to wake the
snapshoter, we can simply wake the snapshoter directly.

20 months agoSkip pinning cpufeatures, which has fixed its MSRV 2022-08-no-pin-cpufeatures
Matt Corallo [Tue, 23 Aug 2022 00:03:34 +0000 (00:03 +0000)]
Skip pinning cpufeatures, which has fixed its MSRV

20 months agoMerge pull request #9 from arik-so/2022-08-snapshot-timestamp-fix
Matt Corallo [Tue, 23 Aug 2022 00:02:03 +0000 (00:02 +0000)]
Merge pull request #9 from arik-so/2022-08-snapshot-timestamp-fix

Reference canonical timestamps when generating snapshots.

20 months agoAlways pin dependencies for 1.48.0.
Arik Sosman [Mon, 22 Aug 2022 23:48:49 +0000 (16:48 -0700)]
Always pin dependencies for 1.48.0.

20 months agoReference canonical timestamps when generating snapshots.
Arik Sosman [Mon, 22 Aug 2022 23:42:20 +0000 (16:42 -0700)]
Reference canonical timestamps when generating snapshots.

20 months agoMerge pull request #8 from arik-so/2022-08-add-0-symlink
Matt Corallo [Mon, 22 Aug 2022 23:12:37 +0000 (23:12 +0000)]
Merge pull request #8 from arik-so/2022-08-add-0-symlink

Add 0.bin symlink for clients requiring an initial rapid sync.

20 months agoMerge pull request #6 from TheBlueMatt/2022-08-cleanups
Arik [Mon, 22 Aug 2022 22:48:44 +0000 (15:48 -0700)]
Merge pull request #6 from TheBlueMatt/2022-08-cleanups

Various Code Cleanups

20 months agoAdd 0.bin symlink for clients requiring an initial rapid sync.
Arik Sosman [Mon, 22 Aug 2022 21:39:02 +0000 (14:39 -0700)]
Add 0.bin symlink for clients requiring an initial rapid sync.

20 months agoCleanup network graph persisting and ensure write succeeds 2022-08-cleanups
Matt Corallo [Mon, 22 Aug 2022 03:30:35 +0000 (03:30 +0000)]
Cleanup network graph persisting and ensure write succeeds

20 months agoTrivial cleanups in lookup.rs
Matt Corallo [Mon, 22 Aug 2022 03:27:50 +0000 (03:27 +0000)]
Trivial cleanups in lookup.rs

20 months agoCorrect error-matching in downloader
Matt Corallo [Mon, 22 Aug 2022 03:24:27 +0000 (03:24 +0000)]
Correct error-matching in downloader

20 months agoDrop Arcs around the TestLogger, as its an empty struct anyway
Matt Corallo [Mon, 22 Aug 2022 03:22:09 +0000 (03:22 +0000)]
Drop Arcs around the TestLogger, as its an empty struct anyway

20 months agoSubstantially reduce boilerplate and Arcs in download_gossip
Matt Corallo [Mon, 22 Aug 2022 03:17:09 +0000 (03:17 +0000)]
Substantially reduce boilerplate and Arcs in download_gossip

20 months agoRemove unnecessary Arcs in verifier.rs
Matt Corallo [Mon, 22 Aug 2022 03:04:41 +0000 (03:04 +0000)]
Remove unnecessary Arcs in verifier.rs

20 months agoClean up the flow and variables in lib.rs and main.rs
Matt Corallo [Mon, 22 Aug 2022 02:39:26 +0000 (02:39 +0000)]
Clean up the flow and variables in lib.rs and main.rs

20 months agoMerge pull request #5 from TheBlueMatt/2022-08-block-on-slow-db
Arik [Mon, 22 Aug 2022 03:03:03 +0000 (20:03 -0700)]
Merge pull request #5 from TheBlueMatt/2022-08-block-on-slow-db

Block tasks if the DB writes get behind, rather than growing the queue.

20 months agoBlock tasks if the DB writes get behind, rather than growing the queue 2022-08-block-on-slow-db
Matt Corallo [Mon, 22 Aug 2022 02:40:23 +0000 (02:40 +0000)]
Block tasks if the DB writes get behind, rather than growing the queue

20 months agoMerge pull request #4 from TheBlueMatt/2022-08-fix-executors
Arik [Mon, 22 Aug 2022 02:43:03 +0000 (19:43 -0700)]
Merge pull request #4 from TheBlueMatt/2022-08-fix-executors

Don't spawn new single-threaded executors, stay inside tokio

20 months agoDon't spawn new single-threaded executors, stay inside tokio 2022-08-fix-executors
Matt Corallo [Mon, 22 Aug 2022 02:18:30 +0000 (02:18 +0000)]
Don't spawn new single-threaded executors, stay inside tokio

20 months agoMerge pull request #3 from lightningdevkit/readme_fixups
Arik [Mon, 22 Aug 2022 02:13:45 +0000 (19:13 -0700)]
Merge pull request #3 from lightningdevkit/readme_fixups

Fix readme links.

20 months agoFix readme links.
Arik Sosman [Mon, 22 Aug 2022 02:13:10 +0000 (19:13 -0700)]
Fix readme links.

20 months agoMerge pull request #2 from lightningdevkit/readme_fixups
Arik [Mon, 22 Aug 2022 02:10:45 +0000 (19:10 -0700)]
Merge pull request #2 from lightningdevkit/readme_fixups

Fix readme.

20 months agoFix readme.
Arik Sosman [Mon, 22 Aug 2022 02:10:23 +0000 (19:10 -0700)]
Fix readme.