htlcswitch+invoices: circuit key based hodl notifications

This commit modifies hodl htlc notification from invoice registry from a
single notification per hash to distinct notifications per htlc. This
prepares for htlc-specific information (accept height) to be added to the
notification.
This commit is contained in:
Joost Jager
2019-08-14 21:11:34 +02:00
parent 49a20a87a2
commit 4e140213f9
3 changed files with 102 additions and 99 deletions

View File

@@ -18,8 +18,9 @@ const (
)
var (
testResPreimage = lntypes.Preimage{1, 2, 3}
testResHash = testResPreimage.Hash()
testResPreimage = lntypes.Preimage{1, 2, 3}
testResHash = testResPreimage.Hash()
testResCircuitKey = channeldb.CircuitKey{}
)
// TestHtlcIncomingResolverFwdPreimageKnown tests resolution of a forwarded htlc
@@ -92,8 +93,8 @@ func TestHtlcIncomingResolverExitSettle(t *testing.T) {
ctx := newIncomingResolverTestContext(t)
ctx.registry.notifyEvent = &invoices.HodlEvent{
Hash: testResHash,
Preimage: &testResPreimage,
CircuitKey: testResCircuitKey,
Preimage: &testResPreimage,
}
ctx.resolve()
@@ -116,7 +117,7 @@ func TestHtlcIncomingResolverExitCancel(t *testing.T) {
ctx := newIncomingResolverTestContext(t)
ctx.registry.notifyEvent = &invoices.HodlEvent{
Hash: testResHash,
CircuitKey: testResCircuitKey,
}
ctx.resolve()
ctx.waitForResult(false)
@@ -133,8 +134,8 @@ func TestHtlcIncomingResolverExitSettleHodl(t *testing.T) {
notifyData := <-ctx.registry.notifyChan
notifyData.hodlChan <- invoices.HodlEvent{
Hash: testResHash,
Preimage: &testResPreimage,
CircuitKey: testResCircuitKey,
Preimage: &testResPreimage,
}
ctx.waitForResult(true)
@@ -162,7 +163,7 @@ func TestHtlcIncomingResolverExitCancelHodl(t *testing.T) {
ctx.resolve()
notifyData := <-ctx.registry.notifyChan
notifyData.hodlChan <- invoices.HodlEvent{
Hash: testResHash,
CircuitKey: testResCircuitKey,
}
ctx.waitForResult(false)
}