Skip to content

Commit 108aadd

Browse files
committed
MinRelayFee func in walletkit_client.go.
Added MinRelayFee func to walletkit_client.go.
1 parent af1aae2 commit 108aadd

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

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(
546+
ctx context.Context) (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)