mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-09 15:04:39 +02:00
aliasmgr: export StartingAlias so other packages can use it
This commit is contained in:
@ -53,10 +53,10 @@ var (
|
||||
// endBlockHeight is the ending block height of the alias range.
|
||||
endBlockHeight = 16_250_000
|
||||
|
||||
// startingAlias is the first alias ShortChannelID that will get
|
||||
// StartingAlias is the first alias ShortChannelID that will get
|
||||
// assigned by RequestAlias. The starting BlockHeight is chosen so that
|
||||
// legitimate SCIDs in integration tests aren't mistaken for an alias.
|
||||
startingAlias = lnwire.ShortChannelID{
|
||||
StartingAlias = lnwire.ShortChannelID{
|
||||
BlockHeight: uint32(startingBlockHeight),
|
||||
TxIndex: 0,
|
||||
TxPosition: 0,
|
||||
@ -401,8 +401,8 @@ func (m *Manager) RequestAlias() (lnwire.ShortChannelID, error) {
|
||||
lastBytes := bucket.Get(lastAliasKey)
|
||||
if lastBytes == nil {
|
||||
// If the key does not exist, then we can write the
|
||||
// startingAlias to it.
|
||||
nextAlias = startingAlias
|
||||
// StartingAlias to it.
|
||||
nextAlias = StartingAlias
|
||||
|
||||
var scratch [8]byte
|
||||
byteOrder.PutUint64(scratch[:], nextAlias.ToUint64())
|
||||
|
@ -32,12 +32,12 @@ func TestAliasStorePeerAlias(t *testing.T) {
|
||||
|
||||
// Test that we can put the (chanID, alias) mapping in the database.
|
||||
// Also check that we retrieve exactly what we put in.
|
||||
err = aliasStore.PutPeerAlias(chanID1, startingAlias)
|
||||
err = aliasStore.PutPeerAlias(chanID1, StartingAlias)
|
||||
require.NoError(t, err)
|
||||
|
||||
storedAlias, err := aliasStore.GetPeerAlias(chanID1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, startingAlias, storedAlias)
|
||||
require.Equal(t, StartingAlias, storedAlias)
|
||||
}
|
||||
|
||||
// TestAliasStoreRequest tests that the aliasStore delivers the expected SCID.
|
||||
@ -55,12 +55,12 @@ func TestAliasStoreRequest(t *testing.T) {
|
||||
aliasStore, err := NewManager(db)
|
||||
require.NoError(t, err)
|
||||
|
||||
// We'll assert that the very first alias we receive is startingAlias.
|
||||
// We'll assert that the very first alias we receive is StartingAlias.
|
||||
alias1, err := aliasStore.RequestAlias()
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, startingAlias, alias1)
|
||||
require.Equal(t, StartingAlias, alias1)
|
||||
|
||||
// The next alias should be the result of passing in startingAlias to
|
||||
// The next alias should be the result of passing in StartingAlias to
|
||||
// getNextScid.
|
||||
nextAlias := getNextScid(alias1)
|
||||
alias2, err := aliasStore.RequestAlias()
|
||||
@ -78,7 +78,7 @@ func TestGetNextScid(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "starting alias",
|
||||
current: startingAlias,
|
||||
current: StartingAlias,
|
||||
expected: lnwire.ShortChannelID{
|
||||
BlockHeight: uint32(startingBlockHeight),
|
||||
TxIndex: 0,
|
||||
|
Reference in New Issue
Block a user