From 618810394ce255077ab78475beccf53c611f75f8 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Wed, 18 Dec 2019 23:53:18 -0800 Subject: [PATCH] routing/pathfind_test: add asymmetric chan consructor Later this will be used to populate distinct feature vectors for either end of the channel. --- routing/pathfind_test.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/routing/pathfind_test.go b/routing/pathfind_test.go index a66d81f05..15fc0d042 100644 --- a/routing/pathfind_test.go +++ b/routing/pathfind_test.go @@ -325,7 +325,7 @@ type testChannelEnd struct { *testChannelPolicy } -func symmetricTestChannel(alias1 string, alias2 string, capacity btcutil.Amount, +func symmetricTestChannel(alias1, alias2 string, capacity btcutil.Amount, policy *testChannelPolicy, chanID ...uint64) *testChannel { // Leaving id zero will result in auto-generation of a channel id during @@ -335,18 +335,26 @@ func symmetricTestChannel(alias1 string, alias2 string, capacity btcutil.Amount, id = chanID[0] } - node2Policy := *policy - node2Policy.Direction = !policy.Direction + policy2 := *policy + policy2.Direction = !policy.Direction + + return asymmetricTestChannel( + alias1, alias2, capacity, policy, &policy2, id, + ) +} + +func asymmetricTestChannel(alias1, alias2 string, capacity btcutil.Amount, + policy1, policy2 *testChannelPolicy, id uint64) *testChannel { return &testChannel{ Capacity: capacity, Node1: &testChannelEnd{ Alias: alias1, - testChannelPolicy: policy, + testChannelPolicy: policy1, }, Node2: &testChannelEnd{ Alias: alias2, - testChannelPolicy: &node2Policy, + testChannelPolicy: policy2, }, ChannelID: id, }