Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minrelayfee func #200

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
23 changes: 23 additions & 0 deletions walletkit_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ type WalletKitClient interface {
EstimateFeeRate(ctx context.Context,
confTarget int32) (chainfee.SatPerKWeight, error)

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

// ListSweeps returns a list of sweep transaction ids known to our node.
// Note that this function only looks up transaction ids, and does not
// query our wallet for the full set of transactions. If startHeight is
Expand Down Expand Up @@ -540,6 +544,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
Loading