Skip to content

Commit 064d010

Browse files
committed
wip
1 parent 2ddae20 commit 064d010

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ require (
103103
github.com/lightningnetwork/lnd/kvdb v1.3.1 // indirect
104104
github.com/lightningnetwork/lnd/ticker v1.1.0 // indirect
105105
github.com/lightningnetwork/lnd/tlv v1.0.3 // indirect
106-
github.com/lightningnetwork/lnd/tor v1.0.1 // indirect
106+
github.com/lightningnetwork/lnd/tor v1.1.0 // indirect
107107
github.com/ltcsuite/ltcd v0.20.1-beta // indirect
108108
github.com/mailru/easyjson v0.7.6 // indirect
109109
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
@@ -182,3 +182,5 @@ require (
182182
)
183183

184184
replace github.com/bottlepay/lnmux/lnmuxrpc => ./lnmuxrpc
185+
186+
replace github.com/lightningnetwork/lnd => /users/Joost.Jager/lightninglabs/lnd

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,6 @@ github.com/lightninglabs/neutrino v0.14.2 h1:yrnZUCYMZ5ECtXhgDrzqPq2oX8awoAN2D/c
507507
github.com/lightninglabs/neutrino v0.14.2/go.mod h1:OICUeTCn+4Tu27YRJIpWvvqySxx4oH4vgdP33Sw9RDc=
508508
github.com/lightningnetwork/lightning-onion v1.0.2-0.20220211021909-bb84a1ccb0c5 h1:TkKwqFcQTGYoI+VEqyxA8rxpCin8qDaYX0AfVRinT3k=
509509
github.com/lightningnetwork/lightning-onion v1.0.2-0.20220211021909-bb84a1ccb0c5/go.mod h1:7dDx73ApjEZA0kcknI799m2O5kkpfg4/gr7N092ojNo=
510-
github.com/lightningnetwork/lnd v0.15.3-beta h1:mm7fyXMgZPRyh0fFLO3tnvfvXszp/kVnGGciS76Wefs=
511-
github.com/lightningnetwork/lnd v0.15.3-beta/go.mod h1:UaCwJBMCJbwPMsUjfTIaKPKF8K79btRPnhqfiNPyKtA=
512510
github.com/lightningnetwork/lnd/clock v1.0.1/go.mod h1:KnQudQ6w0IAMZi1SgvecLZQZ43ra2vpDNj7H/aasemg=
513511
github.com/lightningnetwork/lnd/clock v1.1.0 h1:/yfVAwtPmdx45aQBoXQImeY7sOIEr7IXlImRMBOZ7GQ=
514512
github.com/lightningnetwork/lnd/clock v1.1.0/go.mod h1:KnQudQ6w0IAMZi1SgvecLZQZ43ra2vpDNj7H/aasemg=
@@ -527,8 +525,8 @@ github.com/lightningnetwork/lnd/tlv v1.0.2/go.mod h1:fICAfsqk1IOsC1J7G9IdsWX1EqW
527525
github.com/lightningnetwork/lnd/tlv v1.0.3 h1:0xBZcPuXagP6f7TY/RnLNR4igE21ov6qUdTr5NyvhhI=
528526
github.com/lightningnetwork/lnd/tlv v1.0.3/go.mod h1:dzR/aZetBri+ZY/fHbwV06fNn/3UID6htQzbHfREFdo=
529527
github.com/lightningnetwork/lnd/tor v1.0.0/go.mod h1:RDtaAdwfAm+ONuPYwUhNIH1RAvKPv+75lHPOegUcz64=
530-
github.com/lightningnetwork/lnd/tor v1.0.1 h1:A11FrpU0Y//g+fA827W4VnjOeoIvExONdchlLX8wYkA=
531-
github.com/lightningnetwork/lnd/tor v1.0.1/go.mod h1:RDtaAdwfAm+ONuPYwUhNIH1RAvKPv+75lHPOegUcz64=
528+
github.com/lightningnetwork/lnd/tor v1.1.0 h1:iXO7fSzjxTI+p88KmtpbuyuRJeNfgtpl9QeaAliILXE=
529+
github.com/lightningnetwork/lnd/tor v1.1.0/go.mod h1:RDtaAdwfAm+ONuPYwUhNIH1RAvKPv+75lHPOegUcz64=
532530
github.com/ltcsuite/ltcd v0.20.1-beta h1:ka9ZwUG7oUPppl+7ptuh5VDxGD7TWEJXu/IOOOz1yfY=
533531
github.com/ltcsuite/ltcd v0.20.1-beta/go.mod h1:ZFQaYdYULIuTQiWqs7AUiHD2XhDFeeHW1IH+UYMdABU=
534532
github.com/ltcsuite/ltcutil v0.0.0-20191227053721-6bec450ea6ad/go.mod h1:8Vg/LTOO0KYa/vlHWJ6XZAevPQThGH5sufO0Hrou/lA=

interceptor.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,11 @@ func (i *interceptor) start(ctx context.Context) error {
156156
ChanId: item.incomingKey.ChanID,
157157
HtlcId: item.incomingKey.HtlcID,
158158
},
159-
Action: item.resp.action,
160-
Preimage: item.resp.preimage[:],
161-
FailureMessage: item.resp.failureMessage,
162-
FailureCode: item.resp.failureCode,
159+
Action: item.resp.action,
160+
Preimage: item.resp.preimage[:],
161+
FailureMessage: item.resp.failureMessage,
162+
FailureCode: item.resp.failureCode,
163+
FailureMessageUnencrypted: item.resp.failureMessageUnencrypted,
163164
}
164165

165166
if err := send(rpcResp); err != nil {

mux.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,11 @@ type interceptedHtlc struct {
115115
}
116116

117117
type interceptedHtlcResponse struct {
118-
action routerrpc.ResolveHoldForwardAction
119-
preimage lntypes.Preimage
120-
failureMessage []byte
121-
failureCode lnrpc.Failure_FailureCode
118+
action routerrpc.ResolveHoldForwardAction
119+
preimage lntypes.Preimage
120+
failureMessage []byte
121+
failureCode lnrpc.Failure_FailureCode
122+
failureMessageUnencrypted bool
122123
}
123124

124125
func (p *Mux) run(mainCtx context.Context) error {
@@ -236,6 +237,21 @@ func (p *Mux) ProcessHtlc(
236237
fail := func(code lnwire.FailCode) error {
237238
logger.Debugw("Failing htlc", "code", code)
238239

240+
if code == lnwire.CodeFeeInsufficient {
241+
wireMsg := lnwire.NewFeeInsufficient(0, lnwire.ChannelUpdate{})
242+
var w bytes.Buffer
243+
err := lnwire.EncodeFailureMessage(&w, wireMsg, 0)
244+
if err != nil {
245+
return err
246+
}
247+
248+
return htlc.reply(&interceptedHtlcResponse{
249+
action: routerrpc.ResolveHoldForwardAction_FAIL,
250+
failureMessage: w.Bytes(),
251+
failureMessageUnencrypted: true,
252+
})
253+
}
254+
239255
rpcCode, err := marshallFailureCode(code)
240256
if err != nil {
241257
return err

0 commit comments

Comments
 (0)