multi: make sure CPFP won't exceed max allowed fee rate

This commit updates the `fee()` method in `weightEstimator` to make sure
when doing CPFP we are not exceeding the max allowed fee rate. In order
to use the max fee rate, we need to modify several methods to pass the
configured value to the estimator.
This commit is contained in:
yyforyongyu authored and Olaoluwa Osuntokun committed 2023-10-06 16:34:47 -07:00
1 parent 42ff52bbfb
commit 24fa35ec80
12 files changed
+132 -48

No files matched your search

+6 -6
View File
@@ -1268,6 +1268,7 @@ func (r *rpcServer) SendCoins(ctx context.Context,
var txid *chainhash.Hash
wallet := r.server.cc.Wallet
maxFeeRate := r.cfg.Sweeper.MaxFeeRate.FeePerKWeight()
// If the send all flag is active, then we'll attempt to sweep all the
// coins in the wallet in a single transaction (if possible),
@@ -1293,10 +1294,9 @@ func (r *rpcServer) SendCoins(ctx context.Context,
// pay to the change address created above if we needed to
// reserve any value, the rest will go to targetAddr.
sweepTxPkg, err := sweep.CraftSweepAllTx(
feePerKw, uint32(bestHeight), nil, targetAddr, wallet,
wallet, wallet.WalletController,
r.server.cc.FeeEstimator, r.server.cc.Signer,
minConfs,
maxFeeRate, feePerKw, uint32(bestHeight), nil,
targetAddr, wallet, wallet, wallet.WalletController,
r.server.cc.FeeEstimator, r.server.cc.Signer, minConfs,
)
if err != nil {
return nil, err
@@ -1347,8 +1347,8 @@ func (r *rpcServer) SendCoins(ctx context.Context,
}
sweepTxPkg, err = sweep.CraftSweepAllTx(
feePerKw, uint32(bestHeight), outputs,
targetAddr, wallet, wallet,
maxFeeRate, feePerKw, uint32(bestHeight),
outputs, targetAddr, wallet, wallet,
wallet.WalletController,
r.server.cc.FeeEstimator, r.server.cc.Signer,
minConfs,