mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-11 14:48:14 +01:00
graph/db: provide SQLStore with chainhash
In this commit, we introduce a SQLStoreConfig struct which for the time being only has the ChainHash of the genesis block of the chain this node is running on. This is used to reconstruct lnwire messages from what we have persisted in the DB. This means we dont need need to persist the chain-hash of gossip messages since we know it will always be the same for a given node. If a node were to be started with a different network, the lnwire messages it reconstructs for gossip will be invalid.
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"database/sql"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
"github.com/lightningnetwork/lnd/sqldb"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -38,7 +39,11 @@ func NewTestDB(t testing.TB) V1Store {
|
||||
},
|
||||
)
|
||||
|
||||
store, err := NewSQLStore(executor, graphStore)
|
||||
store, err := NewSQLStore(
|
||||
&SQLStoreConfig{
|
||||
ChainHash: *chaincfg.MainNetParams.GenesisHash,
|
||||
}, executor, graphStore,
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
return store
|
||||
|
||||
Reference in New Issue
Block a user