Commit Graph

11 Commits

Author SHA1 Message Date
Oliver Gugger
604bd81100
aliasmgr: export alias start and end ranges
Because we restrict custom SCID aliases to be in a specific range, we
export the range start and end values so a user of the RPCs we're going
to add in the next commits can adjust their values to fit within the
range.
2024-09-05 08:44:33 +02:00
Oliver Gugger
466f550ddb
aliasmgr: avoid collision when requesting alias
With the new RPC calls that we are going to add in the next commits, it
will be possible for users to add (local only, non-gossipped) SCID
aliases for channels. Since those will be in the same range as the ones
given out by RequestAlias, we need to make sure that when we generate a
new one that it doesn't collide with an already existing one.
2024-09-05 08:44:33 +02:00
Oliver Gugger
80dfaeb16d
aliasmgr: add map type alias 2024-09-05 08:44:33 +02:00
George Tsagkarelis
ea92d0aecc
multi: refresh htlcswitch aliases on aliasmgr update 2024-09-05 08:44:32 +02:00
George Tsagkarelis
e31cdc4db3
aliasmgr: add delete local alias method 2024-09-05 08:44:32 +02:00
yyforyongyu
f8a8326141
multi: replace FundingLocked and funding_locked strings
This commit is created by running the following commands,
```shell
find . -name "*.go" -exec sed -i '' 's/\"FundingLocked/\"ChannelReady/g' {} \;
find . -name "*.go" -exec sed -i '' 's/FundingLocked\"/ChannelReady\"/g' {} \;
find . -name "*.go" -exec sed -i '' 's/\ funding_locked/\ channel_ready/g' {} \;
```
2023-03-17 18:21:59 +08:00
eugene
feb8e7e64e
aliasmgr: export StartingAlias so other packages can use it 2023-01-25 12:03:19 -05:00
positiveblue
584f1089f7
aliasmgr: cache peer alias in memory 2022-09-30 06:55:16 -07:00
Eng Zer Jun
1cd7e3aee6
aliasmgr: use T.TempDir to create temporary test directory
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-08-24 08:58:11 +08:00
eugene
aa576adecc
rpc+cli: add general ListAliases function to dump all aliases 2022-08-09 14:11:08 -04:00
eugene
15b871de36
aliasmgr: new data store containing our, peer's aliases
This introduces the a store for managing all things alias-related.

There are two maps:

* baseToSet:
  This stores the "base" short channel id as the key. The value is
  the set of all aliases issued for this channel. The "base" SCID is
  whatever is stored in the OpenChannel's ShortChannelID member. For
  everything other than zero-conf channels, this is the confirmed SCID.
  For zero-conf channels, this is the very first alias assigned. This is
  used mostly by the Switch to retrieve a set of aliases and determine
  if it is safe to forward.

* aliasToBase:
  This stores the reverse mapping of baseToSet. Each key is an alias
  SCID and the value is the "base" SCID. This is exclusively used by
  the gossiper to determine if an alias in a ChannelUpdate our peer
  sends actually references a channel we know of.

The functions make use of the above two maps:

* AddLocalAlias:
  This persists the {alias, base} pair in the database. The baseToSet
  map is populated. The aliasToBase is optionally populated depending on
  where this function is called from. Upgrade cases, where the
  scid-alias feature bit is toggled and channels already exist, will
  not persist to the gossip map. This is mainly to simplify the tangle
  of logic that would otherwise occur.

* GetAliases:
  This fetches the set of aliases by using the passed-in base SCID. This
  is used in the Switch and other places where the alias set is needed.

* FindBaseSCID:
  This fetches the base given an alias. This is used in the gossiper to
  determine validity of a peer's ChannelUpdate that contains an alias.

* DeleteSixConfs:
  This removes the aliasToBase map entry for the given "base". This is
  used when the gossiper mappings are no longer needed, i.e. when the
  channel has six confirmations and is public.

* PutPeerAlias:
  Stores the peer's alias.

* GetPeerAlias:
  Fetches the peer's alias.

* RequestAlias:
  Generates an alias for us in the range 16000000:0:0 and
  16250000:16777215:65535
2022-07-07 17:10:27 -04:00