htlcswitch: obtain the min final CLTV delta directly from the InvoiceDatabase
In this commit, we modify the existing logic that would attempt to read the min CLTV information from the invoice directly. With this route, we avoid any sort of DB index modifications, as this information is already stored within the payment request, which is already available to the outside callers. By modifying the InvoiceDatabase interface, we avoid having to make the switch aware of what the "primary" chain is.
This commit is contained in:
6 files changed
+72
-54
No files matched your search
@@ -844,16 +844,24 @@ func newThreeHopNetwork(t testing.TB, aliceChannel, firstBobChannel,
|
||||
bobDb := firstBobChannel.State().Db
|
||||
carolDb := carolChannel.State().Db
|
||||
|
||||
defaultDelta := uint32(6)
|
||||
|
||||
// Create three peers/servers.
|
||||
aliceServer, err := newMockServer(t, "alice", startingHeight, aliceDb)
|
||||
aliceServer, err := newMockServer(
|
||||
t, "alice", startingHeight, aliceDb, defaultDelta,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create alice server: %v", err)
|
||||
}
|
||||
bobServer, err := newMockServer(t, "bob", startingHeight, bobDb)
|
||||
bobServer, err := newMockServer(
|
||||
t, "bob", startingHeight, bobDb, defaultDelta,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create bob server: %v", err)
|
||||
}
|
||||
carolServer, err := newMockServer(t, "carol", startingHeight, carolDb)
|
||||
carolServer, err := newMockServer(
|
||||
t, "carol", startingHeight, carolDb, defaultDelta,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to create carol server: %v", err)
|
||||
}
|
||||
@@ -883,7 +891,7 @@ func newThreeHopNetwork(t testing.TB, aliceChannel, firstBobChannel,
|
||||
globalPolicy := ForwardingPolicy{
|
||||
MinHTLC: lnwire.NewMSatFromSatoshis(5),
|
||||
BaseFee: lnwire.NewMSatFromSatoshis(1),
|
||||
TimeLockDelta: 6,
|
||||
TimeLockDelta: defaultDelta,
|
||||
}
|
||||
obfuscator := NewMockObfuscator()
|
||||
|
||||
|
||||
Reference in new issue
Block a user