multi: move 3 vars from walletrpc+lncfg to chanfunding

This commit moves the constants LndInternalLockID and
DefaultLockDuration from the walletrpc package to the chanfunding
package, moves DefaultReservationTimeout from lncfg to chanfunding,
and also updates the lncli package with the new location.
This commit is contained in:
Alex Akselrod committed 2024-03-13 09:50:16 -07:00
1 parent 07ba9d6015
commit 4d2ab7423f
8 files changed
+42 -31

No files matched your search

+5 -9
View File
@@ -6,23 +6,18 @@ package walletrpc
import (
"fmt"
"math"
"time"
"github.com/btcsuite/btcd/wire"
base "github.com/btcsuite/btcwallet/wallet"
"github.com/btcsuite/btcwallet/wtxmgr"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwallet/chanfunding"
)
const (
defaultMaxConf = math.MaxInt32
)
var (
// DefaultLockDuration is the default duration used to lock outputs.
DefaultLockDuration = 10 * time.Minute
)
// verifyInputsUnspent checks that all inputs are contained in the list of
// known, non-locked UTXOs given.
func verifyInputsUnspent(inputs []*wire.TxIn, utxos []*lnwallet.Utxo) error {
@@ -56,13 +51,14 @@ func lockInputs(w lnwallet.WalletController,
for idx := range outpoints {
lock := &base.ListLeasedOutputResult{
LockedOutput: &wtxmgr.LockedOutput{
LockID: LndInternalLockID,
LockID: chanfunding.LndInternalLockID,
Outpoint: outpoints[idx],
},
}
expiration, pkScript, value, err := w.LeaseOutput(
lock.LockID, lock.Outpoint, DefaultLockDuration,
lock.LockID, lock.Outpoint,
chanfunding.DefaultLockDuration,
)
if err != nil {
// If we run into a problem with locking one output, we
@@ -72,7 +68,7 @@ func lockInputs(w lnwallet.WalletController,
for i := 0; i < idx; i++ {
op := locks[i].Outpoint
if err := w.ReleaseOutput(
LndInternalLockID, op,
chanfunding.LndInternalLockID, op,
); err != nil {
log.Errorf("could not release the "+
"lock on %v: %v", op, err)