htlcswitch: rename policy check functions
This commit is contained in:
5 files changed
+38
-39
No files matched your search
@@ -5396,9 +5396,9 @@ func TestForwardingAsymmetricTimeLockPolicies(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestHtlcSatisfyPolicy tests that a link is properly enforcing the HTLC
|
||||
// TestCheckHtlcForward tests that a link is properly enforcing the HTLC
|
||||
// forwarding policy.
|
||||
func TestHtlcSatisfyPolicy(t *testing.T) {
|
||||
func TestCheckHtlcForward(t *testing.T) {
|
||||
|
||||
fetchLastChannelUpdate := func(lnwire.ShortChannelID) (
|
||||
*lnwire.ChannelUpdate, error) {
|
||||
@@ -5423,7 +5423,7 @@ func TestHtlcSatisfyPolicy(t *testing.T) {
|
||||
var hash [32]byte
|
||||
|
||||
t.Run("satisfied", func(t *testing.T) {
|
||||
result := link.HtlcSatifiesPolicy(hash, 1500, 1000,
|
||||
result := link.CheckHtlcForward(hash, 1500, 1000,
|
||||
200, 150, 0)
|
||||
if result != nil {
|
||||
t.Fatalf("expected policy to be satisfied")
|
||||
@@ -5431,7 +5431,7 @@ func TestHtlcSatisfyPolicy(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("below minhtlc", func(t *testing.T) {
|
||||
result := link.HtlcSatifiesPolicy(hash, 100, 50,
|
||||
result := link.CheckHtlcForward(hash, 100, 50,
|
||||
200, 150, 0)
|
||||
if _, ok := result.(*lnwire.FailAmountBelowMinimum); !ok {
|
||||
t.Fatalf("expected FailAmountBelowMinimum failure code")
|
||||
@@ -5439,7 +5439,7 @@ func TestHtlcSatisfyPolicy(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("above maxhtlc", func(t *testing.T) {
|
||||
result := link.HtlcSatifiesPolicy(hash, 1500, 1200,
|
||||
result := link.CheckHtlcForward(hash, 1500, 1200,
|
||||
200, 150, 0)
|
||||
if _, ok := result.(*lnwire.FailTemporaryChannelFailure); !ok {
|
||||
t.Fatalf("expected FailTemporaryChannelFailure failure code")
|
||||
@@ -5447,7 +5447,7 @@ func TestHtlcSatisfyPolicy(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("insufficient fee", func(t *testing.T) {
|
||||
result := link.HtlcSatifiesPolicy(hash, 1005, 1000,
|
||||
result := link.CheckHtlcForward(hash, 1005, 1000,
|
||||
200, 150, 0)
|
||||
if _, ok := result.(*lnwire.FailFeeInsufficient); !ok {
|
||||
t.Fatalf("expected FailFeeInsufficient failure code")
|
||||
@@ -5455,7 +5455,7 @@ func TestHtlcSatisfyPolicy(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("expiry too soon", func(t *testing.T) {
|
||||
result := link.HtlcSatifiesPolicy(hash, 1500, 1000,
|
||||
result := link.CheckHtlcForward(hash, 1500, 1000,
|
||||
200, 150, 190)
|
||||
if _, ok := result.(*lnwire.FailExpiryTooSoon); !ok {
|
||||
t.Fatalf("expected FailExpiryTooSoon failure code")
|
||||
@@ -5463,7 +5463,7 @@ func TestHtlcSatisfyPolicy(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("incorrect cltv expiry", func(t *testing.T) {
|
||||
result := link.HtlcSatifiesPolicy(hash, 1500, 1000,
|
||||
result := link.CheckHtlcForward(hash, 1500, 1000,
|
||||
200, 190, 0)
|
||||
if _, ok := result.(*lnwire.FailIncorrectCltvExpiry); !ok {
|
||||
t.Fatalf("expected FailIncorrectCltvExpiry failure code")
|
||||
@@ -5473,7 +5473,7 @@ func TestHtlcSatisfyPolicy(t *testing.T) {
|
||||
|
||||
t.Run("cltv expiry too far in the future", func(t *testing.T) {
|
||||
// Check that expiry isn't too far in the future.
|
||||
result := link.HtlcSatifiesPolicy(hash, 1500, 1000,
|
||||
result := link.CheckHtlcForward(hash, 1500, 1000,
|
||||
10200, 10100, 0)
|
||||
if _, ok := result.(*lnwire.FailExpiryTooFar); !ok {
|
||||
t.Fatalf("expected FailExpiryTooFar failure code")
|
||||
|
||||
Reference in new issue
Block a user