routing: allow custom dest feature bits in integratedRoutingContext.testPayment

This is a preparatory commit for a new test to ensure that if a node
only has the TLV and payment addr feature bits, we don't try to split a
payment.
This commit is contained in:
Olaoluwa Osuntokun 2021-02-03 17:52:08 -08:00
parent 301f1a870e
commit 27c1779757
No known key found for this signature in database
GPG Key ID: 3BBD59E99B280306

@ -88,8 +88,16 @@ func (h htlcAttempt) String() string {
// testPayment launches a test payment and asserts that it is completed after
// the expected number of attempts.
func (c *integratedRoutingContext) testPayment(maxParts uint32) ([]htlcAttempt,
error) {
func (c *integratedRoutingContext) testPayment(maxParts uint32,
destFeatureBits ...lnwire.FeatureBit) ([]htlcAttempt, error) {
// We start out with the base set of MPP feature bits. If the caller
// overrides this set of bits, then we'll use their feature bits
// entirely.
baseFeatureBits := mppFeatures
if len(destFeatureBits) != 0 {
baseFeatureBits = lnwire.NewRawFeatureVector(destFeatureBits...)
}
var (
nextPid uint64
@ -136,7 +144,7 @@ func (c *integratedRoutingContext) testPayment(maxParts uint32) ([]htlcAttempt,
FeeLimit: lnwire.MaxMilliSatoshi,
Target: c.target.pubkey,
PaymentAddr: &paymentAddr,
DestFeatures: lnwire.NewFeatureVector(mppFeatures, nil),
DestFeatures: lnwire.NewFeatureVector(baseFeatureBits, nil),
Amount: c.amt,
CltvLimit: math.MaxUint32,
MaxParts: maxParts,