mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-18 10:06:51 +01:00
Merge pull request #8961 from yyforyongyu/fix-leaseoutput
Improve the performace of `LeaseOutput`
This commit is contained in:
@@ -56,7 +56,13 @@ func lockInputs(w lnwallet.WalletController,
|
||||
},
|
||||
}
|
||||
|
||||
expiration, pkScript, value, err := w.LeaseOutput(
|
||||
// Get the details about this outpoint.
|
||||
utxo, err := w.FetchOutpointInfo(&lock.Outpoint)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("fetch outpoint info: %w", err)
|
||||
}
|
||||
|
||||
expiration, err := w.LeaseOutput(
|
||||
lock.LockID, lock.Outpoint,
|
||||
chanfunding.DefaultLockDuration,
|
||||
)
|
||||
@@ -80,8 +86,8 @@ func lockInputs(w lnwallet.WalletController,
|
||||
}
|
||||
|
||||
lock.Expiration = expiration
|
||||
lock.PkScript = pkScript
|
||||
lock.Value = int64(value)
|
||||
lock.PkScript = utxo.PkScript
|
||||
lock.Value = int64(utxo.Value)
|
||||
locks[idx] = lock
|
||||
}
|
||||
|
||||
|
||||
@@ -496,7 +496,7 @@ func (w *WalletKit) LeaseOutput(ctx context.Context,
|
||||
// other concurrent processes attempting to lease the same UTXO.
|
||||
var expiration time.Time
|
||||
err = w.cfg.CoinSelectionLocker.WithCoinSelectLock(func() error {
|
||||
expiration, _, _, err = w.cfg.Wallet.LeaseOutput(
|
||||
expiration, err = w.cfg.Wallet.LeaseOutput(
|
||||
lockID, *op, duration,
|
||||
)
|
||||
return err
|
||||
@@ -1296,7 +1296,7 @@ func (w *WalletKit) sweepNewInput(op *wire.OutPoint, currentHeight uint32,
|
||||
//
|
||||
// We'll gather all of the information required by the UtxoSweeper in
|
||||
// order to sweep the output.
|
||||
utxo, err := w.cfg.Wallet.FetchInputInfo(op)
|
||||
utxo, err := w.cfg.Wallet.FetchOutpointInfo(op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user