Skip to content

Commit da11abd

Browse files
GeorgeTsagkgijswijs
authored andcommitted
invoices: add CancelSet flag to HtlcModifier
1 parent 9149a10 commit da11abd

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

invoices_client.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ type InvoiceHtlcModifyResponse struct {
5454
// HTLC in case of custom channels. To not modify the amount and use the
5555
// on-chain amount, set this to 0.
5656
AmtPaid lnwire.MilliSatoshi
57+
58+
// CancelSet is a flag that indicates whether the HTLCs associated with
59+
// the invoice should get cancelled.
60+
CancelSet bool
5761
}
5862

5963
// InvoiceHtlcModifyHandler is a function that handles an HTLC modification
@@ -379,7 +383,8 @@ func (s *invoicesClient) HtlcModifier(ctx context.Context,
379383
ChanId: key.ChanID.ToUint64(),
380384
HtlcId: key.HtlcID,
381385
},
382-
AmtPaid: &amtPaid,
386+
AmtPaid: &amtPaid,
387+
CancelSet: resp.CancelSet,
383388
}
384389

385390
if err := stream.Send(rpcResp); err != nil {

macaroon_recipes.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ var (
4343
"EstimateFeeToP2WSH": "EstimateFee",
4444
"OpenChannelStream": "OpenChannel",
4545
"ListSweepsVerbose": "ListSweeps",
46+
"MinRelayFee": "EstimateFee",
4647
}
4748

4849
// ignores is a list of method names on the client implementations that

walletkit_client.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,25 @@ func (m *walletKitClient) EstimateFeeRate(ctx context.Context, confTarget int32)
540540
return chainfee.SatPerKWeight(resp.SatPerKw), nil
541541
}
542542

543+
// MinRelayFee returns the current minimum relay fee based on our chain backend
544+
// in sat/kw.
545+
func (m *walletKitClient) MinRelayFee(ctx context.Context) (
546+
chainfee.SatPerKWeight, error) {
547+
548+
rpcCtx, cancel := context.WithTimeout(ctx, m.timeout)
549+
defer cancel()
550+
551+
rpcCtx = m.walletKitMac.WithMacaroonAuth(rpcCtx)
552+
resp, err := m.client.EstimateFee(rpcCtx, &walletrpc.EstimateFeeRequest{
553+
ConfTarget: 6,
554+
})
555+
if err != nil {
556+
return 0, err
557+
}
558+
559+
return chainfee.SatPerKWeight(resp.MinRelayFeeSatPerKw), nil
560+
}
561+
543562
// ListSweeps returns a list of sweep transaction ids known to our node.
544563
// Note that this function only looks up transaction ids (Verbose=false), and
545564
// does not query our wallet for the full set of transactions.

0 commit comments

Comments
 (0)