@@ -30,6 +30,11 @@ type testGraph interface {
30
30
addRandNode () (* btcec.PublicKey , error )
31
31
}
32
32
33
+ type testDBGraph struct {
34
+ db * graphdb.ChannelGraph
35
+ databaseChannelGraph
36
+ }
37
+
33
38
func newDiskChanGraph (t * testing.T ) (testGraph , error ) {
34
39
backend , err := kvdb .GetBoltBackend (& kvdb.BoltBackendConfig {
35
40
DBPath : t .TempDir (),
@@ -44,12 +49,15 @@ func newDiskChanGraph(t *testing.T) (testGraph, error) {
44
49
graphDB , err := graphdb .NewChannelGraph (backend )
45
50
require .NoError (t , err )
46
51
47
- return & databaseChannelGraph {
52
+ return & testDBGraph {
48
53
db : graphDB ,
54
+ databaseChannelGraph : databaseChannelGraph {
55
+ db : graphDB ,
56
+ },
49
57
}, nil
50
58
}
51
59
52
- var _ testGraph = (* databaseChannelGraph )(nil )
60
+ var _ testGraph = (* testDBGraph )(nil )
53
61
54
62
func newMemChanGraph (_ * testing.T ) (testGraph , error ) {
55
63
return newMemChannelGraph (), nil
@@ -378,7 +386,7 @@ func TestPrefAttachmentSelectSkipNodes(t *testing.T) {
378
386
// addRandChannel creates a new channel two target nodes. This function is
379
387
// meant to aide in the generation of random graphs for use within test cases
380
388
// the exercise the autopilot package.
381
- func (d * databaseChannelGraph ) addRandChannel (node1 , node2 * btcec.PublicKey ,
389
+ func (d * testDBGraph ) addRandChannel (node1 , node2 * btcec.PublicKey ,
382
390
capacity btcutil.Amount ) (* ChannelEdge , * ChannelEdge , error ) {
383
391
384
392
fetchNode := func (pub * btcec.PublicKey ) (* models.LightningNode , error ) {
@@ -522,7 +530,7 @@ func (d *databaseChannelGraph) addRandChannel(node1, node2 *btcec.PublicKey,
522
530
nil
523
531
}
524
532
525
- func (d * databaseChannelGraph ) addRandNode () (* btcec.PublicKey , error ) {
533
+ func (d * testDBGraph ) addRandNode () (* btcec.PublicKey , error ) {
526
534
nodeKey , err := randKey ()
527
535
if err != nil {
528
536
return nil , err
0 commit comments