From 3dfc1725d810e8b4459944ffc9a4571ad9c77ebe Mon Sep 17 00:00:00 2001 From: Elle Mouton Date: Thu, 8 May 2025 10:14:27 +0200 Subject: [PATCH] graph/db: use mainnet genisis hash in tests In preparation for our SQL Graph store which wont explicitly store the chain hash but will instead obtain it from the runtime config, we replace the test chainhash value with that of the mainnet genesis hash. --- graph/db/graph_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/graph/db/graph_test.go b/graph/db/graph_test.go index 37b27d9f7..cae2042b7 100644 --- a/graph/db/graph_test.go +++ b/graph/db/graph_test.go @@ -19,6 +19,7 @@ import ( "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcec/v2/ecdsa" "github.com/btcsuite/btcd/btcutil" + "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/wire" "github.com/lightningnetwork/lnd/graph/db/models" @@ -329,7 +330,7 @@ func TestEdgeInsertionDeletion(t *testing.T) { require.NoError(t, err, "unable to generate node key") edgeInfo := models.ChannelEdgeInfo{ ChannelID: chanID, - ChainHash: key, + ChainHash: *chaincfg.MainNetParams.GenesisHash, AuthProof: &models.ChannelAuthProof{ NodeSig1Bytes: testSig.Serialize(), NodeSig2Bytes: testSig.Serialize(), @@ -409,7 +410,7 @@ func createEdge(height, txIndex uint32, txPosition uint16, outPointIndex uint32, node2Pub, _ := node2.PubKey() edgeInfo := models.ChannelEdgeInfo{ ChannelID: shortChanID.ToUint64(), - ChainHash: key, + ChainHash: *chaincfg.MainNetParams.GenesisHash, AuthProof: &models.ChannelAuthProof{ NodeSig1Bytes: testSig.Serialize(), NodeSig2Bytes: testSig.Serialize(), @@ -652,7 +653,7 @@ func createChannelEdge(node1, node2 *models.LightningNode) ( // errors. edgeInfo := &models.ChannelEdgeInfo{ ChannelID: chanID, - ChainHash: key, + ChainHash: *chaincfg.MainNetParams.GenesisHash, AuthProof: &models.ChannelAuthProof{ NodeSig1Bytes: testSig.Serialize(), NodeSig2Bytes: testSig.Serialize(), @@ -1363,7 +1364,7 @@ func fillTestGraph(t testing.TB, graph *ChannelGraph, numNodes, edgeInfo := models.ChannelEdgeInfo{ ChannelID: chanID, - ChainHash: key, + ChainHash: *chaincfg.MainNetParams.GenesisHash, AuthProof: &models.ChannelAuthProof{ NodeSig1Bytes: testSig.Serialize(), NodeSig2Bytes: testSig.Serialize(), @@ -1545,7 +1546,7 @@ func TestGraphPruning(t *testing.T) { edgeInfo := models.ChannelEdgeInfo{ ChannelID: chanID, - ChainHash: key, + ChainHash: *chaincfg.MainNetParams.GenesisHash, AuthProof: &models.ChannelAuthProof{ NodeSig1Bytes: testSig.Serialize(), NodeSig2Bytes: testSig.Serialize(),