routing/pathfind_test: add asymmetric chan consructor
Later this will be used to populate distinct feature vectors for either end of the channel.
This commit is contained in:
1 file changed
+13
-5
@@ -325,7 +325,7 @@ type testChannelEnd struct {
|
|||||||
*testChannelPolicy
|
*testChannelPolicy
|
||||||
}
|
}
|
||||||
|
|
||||||
func symmetricTestChannel(alias1 string, alias2 string, capacity btcutil.Amount,
|
func symmetricTestChannel(alias1, alias2 string, capacity btcutil.Amount,
|
||||||
policy *testChannelPolicy, chanID ...uint64) *testChannel {
|
policy *testChannelPolicy, chanID ...uint64) *testChannel {
|
||||||
|
|
||||||
// Leaving id zero will result in auto-generation of a channel id during
|
// 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]
|
id = chanID[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
node2Policy := *policy
|
policy2 := *policy
|
||||||
node2Policy.Direction = !policy.Direction
|
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{
|
return &testChannel{
|
||||||
Capacity: capacity,
|
Capacity: capacity,
|
||||||
Node1: &testChannelEnd{
|
Node1: &testChannelEnd{
|
||||||
Alias: alias1,
|
Alias: alias1,
|
||||||
testChannelPolicy: policy,
|
testChannelPolicy: policy1,
|
||||||
},
|
},
|
||||||
Node2: &testChannelEnd{
|
Node2: &testChannelEnd{
|
||||||
Alias: alias2,
|
Alias: alias2,
|
||||||
testChannelPolicy: &node2Policy,
|
testChannelPolicy: policy2,
|
||||||
},
|
},
|
||||||
ChannelID: id,
|
ChannelID: id,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user