mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-29 18:10:48 +02:00
rpc: minConfs and spendUnconfirmed for EstimateFee
This commit is contained in:
13
rpcserver.go
13
rpcserver.go
@ -975,7 +975,7 @@ func (r *rpcServer) sendCoinsOnChain(paymentMap map[string]int64,
|
||||
// We first do a dry run, to sanity check we won't spend our wallet
|
||||
// balance below the reserved amount.
|
||||
authoredTx, err := r.server.cc.Wallet.CreateSimpleTx(
|
||||
outputs, feeRate, true,
|
||||
outputs, feeRate, minConfs, true,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -1073,12 +1073,21 @@ func (r *rpcServer) EstimateFee(ctx context.Context,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Then, we'll extract the minimum number of confirmations that each
|
||||
// output we use to fund the transaction should satisfy.
|
||||
minConfs, err := lnrpc.ExtractMinConfs(
|
||||
in.GetMinConfs(), in.GetSpendUnconfirmed(),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// We will ask the wallet to create a tx using this fee rate. We set
|
||||
// dryRun=true to avoid inflating the change addresses in the db.
|
||||
var tx *txauthor.AuthoredTx
|
||||
wallet := r.server.cc.Wallet
|
||||
err = wallet.WithCoinSelectLock(func() error {
|
||||
tx, err = wallet.CreateSimpleTx(outputs, feePerKw, true)
|
||||
tx, err = wallet.CreateSimpleTx(outputs, feePerKw, minConfs, true)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user