diff --git a/cln/cln_interceptor.go b/cln/cln_interceptor.go index 0efa6a8..a2c6162 100644 --- a/cln/cln_interceptor.go +++ b/cln/cln_interceptor.go @@ -144,19 +144,6 @@ func (i *ClnHtlcInterceptor) intercept() error { } } - log.Printf("correlationid: %v\nhtlc: %v\nchanID: %v\nnextHop: %v\nincoming amount: %v\noutgoing amount: %v\nincoming expiry: %v\noutgoing expiry: %v\npaymentHash: %v\nonionBlob: %v\n\n", - request.Correlationid, - request.Htlc, - request.Onion.ShortChannelId, - nextHop, - request.Htlc.AmountMsat, //with fees - request.Onion.ForwardMsat, - request.Htlc.CltvExpiryRelative, - request.Htlc.CltvExpiry, - request.Htlc.PaymentHash, - request, - ) - i.doneWg.Add(1) go func() { paymentHash, err := hex.DecodeString(request.Htlc.PaymentHash) diff --git a/interceptor/intercept.go b/interceptor/intercept.go index 2f851b7..ae7545d 100644 --- a/interceptor/intercept.go +++ b/interceptor/intercept.go @@ -84,8 +84,7 @@ func (i *Interceptor) Intercept(nextHop string, reqPaymentHash []byte, reqOutgoi FailureCode: FAILURE_TEMPORARY_NODE_FAILURE, }, nil } - log.Printf("paymentHash:%x\npaymentSecret:%x\ndestination:%x\nincomingAmountMsat:%v\noutgoingAmountMsat:%v", - paymentHash, paymentSecret, destination, incomingAmountMsat, outgoingAmountMsat) + if paymentSecret == nil || (nextHop != "" && nextHop != hex.EncodeToString(destination)) { return InterceptResult{ Action: INTERCEPT_RESUME, @@ -96,7 +95,7 @@ func (i *Interceptor) Intercept(nextHop string, reqPaymentHash []byte, reqOutgoi if bytes.Equal(paymentHash, reqPaymentHash) { // TODO: When opening_fee_params is enforced, turn this check in a temporary channel failure. if params == nil { - log.Printf("DEPRECATED: Intercepted htlc with deprecated fee mechanism.") + log.Printf("DEPRECATED: Intercepted htlc with deprecated fee mechanism. Using default fees. payment hash: %s", reqPaymentHashStr) params = &OpeningFeeParams{ MinMsat: uint64(i.config.ChannelMinimumFeeMsat), Proportional: uint32(i.config.ChannelFeePermyriad * 100), @@ -131,7 +130,7 @@ func (i *Interceptor) Intercept(nextHop string, reqPaymentHash []byte, reqOutgoi }, nil } - log.Printf("Intercepted expired payment registration. Opening channel anyway, because it's cheaper at the current rate. %+v", params) + log.Printf("Intercepted expired payment registration. Opening channel anyway, because it's cheaper at the current rate. paymenthash: %s, params: %+v", reqPaymentHashStr, params) } channelPoint, err = i.openChannel(reqPaymentHash, destination, incomingAmountMsat, tag) @@ -230,7 +229,7 @@ func (i *Interceptor) Intercept(nextHop string, reqPaymentHash []byte, reqOutgoi for { chanResult, _ := i.client.GetChannel(destination, *channelPoint) if chanResult != nil { - log.Printf("channel opended successfully alias: %v, confirmed: %v", chanResult.InitialChannelID.ToString(), chanResult.ConfirmedChannelID.ToString()) + log.Printf("channel opened successfully alias: %v, confirmed: %v", chanResult.InitialChannelID.ToString(), chanResult.ConfirmedChannelID.ToString()) err := i.store.InsertChannel( uint64(chanResult.InitialChannelID), @@ -271,7 +270,7 @@ func (i *Interceptor) Intercept(nextHop string, reqPaymentHash []byte, reqOutgoi <-time.After(1 * time.Second) } - log.Printf("Error: Channel failed to opened... timed out. ") + log.Printf("Error: Channel failed to open... timed out. ") return InterceptResult{ Action: INTERCEPT_FAIL_HTLC_WITH_CODE, FailureCode: FAILURE_TEMPORARY_CHANNEL_FAILURE, diff --git a/lnd/interceptor.go b/lnd/interceptor.go index 7affba9..925a6eb 100644 --- a/lnd/interceptor.go +++ b/lnd/interceptor.go @@ -2,7 +2,6 @@ package lnd import ( "context" - "fmt" "log" "sync" "time" @@ -138,18 +137,6 @@ func (i *LndHtlcInterceptor) intercept() error { } } - fmt.Printf("htlc: %v\nchanID: %v\nnextHop: %v\nincoming amount: %v\noutgoing amount: %v\nincomin expiry: %v\noutgoing expiry: %v\npaymentHash: %x\nonionBlob: %x\n\n", - request.IncomingCircuitKey.HtlcId, - request.IncomingCircuitKey.ChanId, - nextHop, - request.IncomingAmountMsat, - request.OutgoingAmountMsat, - request.IncomingExpiry, - request.OutgoingExpiry, - request.PaymentHash, - request.OnionBlob, - ) - i.doneWg.Add(1) go func() { interceptResult := i.interceptor.Intercept(nextHop, request.PaymentHash, request.OutgoingAmountMsat, request.OutgoingExpiry, request.IncomingExpiry)