htlcswitch: check channel policy for local htlcs

This commit is contained in:
Joost Jager
2019-04-19 11:11:16 +02:00
parent e571532d9a
commit f5f6a52ed8
7 changed files with 162 additions and 78 deletions

View File

@@ -612,6 +612,8 @@ type mockChannelLink struct {
eligible bool
htlcID uint64
htlcSatifiesPolicyLocalResult lnwire.FailureMessage
}
// completeCircuit is a helper method for adding the finalized payment circuit
@@ -675,6 +677,13 @@ func (f *mockChannelLink) HtlcSatifiesPolicy([32]byte, lnwire.MilliSatoshi,
return nil
}
func (f *mockChannelLink) HtlcSatifiesPolicyLocal(payHash [32]byte,
amt lnwire.MilliSatoshi, timeout uint32,
heightNow uint32) lnwire.FailureMessage {
return f.htlcSatifiesPolicyLocalResult
}
func (f *mockChannelLink) Stats() (uint64, lnwire.MilliSatoshi, lnwire.MilliSatoshi) {
return 0, 0, 0
}
@@ -728,7 +737,7 @@ func newDB() (*channeldb.DB, func(), error) {
return cdb, cleanUp, nil
}
const testInvoiceCltvExpiry = 4
const testInvoiceCltvExpiry = 6
type mockInvoiceRegistry struct {
settleChan chan lntypes.Hash