Skip to content

Commit

Permalink
MinRelayFee func in walletkit_client.go.
Browse files Browse the repository at this point in the history
Added MinRelayFee func to walletkit_client.go.
  • Loading branch information
gijswijs committed Oct 29, 2024
1 parent af1aae2 commit 108aadd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions macaroon_recipes.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var (
"EstimateFeeToP2WSH": "EstimateFee",
"OpenChannelStream": "OpenChannel",
"ListSweepsVerbose": "ListSweeps",
"MinRelayFee": "EstimateFee",
}

// ignores is a list of method names on the client implementations that
Expand Down
19 changes: 19 additions & 0 deletions walletkit_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,25 @@ func (m *walletKitClient) EstimateFeeRate(ctx context.Context, confTarget int32)
return chainfee.SatPerKWeight(resp.SatPerKw), nil
}

// MinRelayFee returns the current minimum relay fee based on our chain backend
// in sat/kw.
func (m *walletKitClient) MinRelayFee(
ctx context.Context) (chainfee.SatPerKWeight, error) {

rpcCtx, cancel := context.WithTimeout(ctx, m.timeout)
defer cancel()

rpcCtx = m.walletKitMac.WithMacaroonAuth(rpcCtx)
resp, err := m.client.EstimateFee(rpcCtx, &walletrpc.EstimateFeeRequest{
ConfTarget: 6,
})
if err != nil {
return 0, err
}

return chainfee.SatPerKWeight(resp.MinRelayFeeSatPerKw), nil
}

// ListSweeps returns a list of sweep transaction ids known to our node.
// Note that this function only looks up transaction ids (Verbose=false), and
// does not query our wallet for the full set of transactions.
Expand Down

0 comments on commit 108aadd

Please sign in to comment.