refactor: use camel case for minConfs
This commit is contained in:
parent
2b5c9e1606
commit
03b55446b5
@ -114,8 +114,8 @@ func (w *WalletController) CreateSimpleTx(outputs []*wire.TxOut,
|
|||||||
|
|
||||||
// ListUnspentWitness is called by the wallet when doing coin selection. We just
|
// ListUnspentWitness is called by the wallet when doing coin selection. We just
|
||||||
// need one unspent for the funding transaction.
|
// need one unspent for the funding transaction.
|
||||||
func (w *WalletController) ListUnspentWitness(minconfirms,
|
func (w *WalletController) ListUnspentWitness(minConfs,
|
||||||
maxconfirms int32, _ string) ([]*lnwallet.Utxo, error) {
|
maxConfs int32, _ string) ([]*lnwallet.Utxo, error) {
|
||||||
|
|
||||||
// If the mock already has a list of utxos, return it.
|
// If the mock already has a list of utxos, return it.
|
||||||
if w.Utxos != nil {
|
if w.Utxos != nil {
|
||||||
|
@ -484,7 +484,7 @@ func (b *BtcWallet) ImportPublicKey(pubKey *btcec.PublicKey,
|
|||||||
//
|
//
|
||||||
// This is a part of the WalletController interface.
|
// This is a part of the WalletController interface.
|
||||||
func (b *BtcWallet) SendOutputs(outputs []*wire.TxOut,
|
func (b *BtcWallet) SendOutputs(outputs []*wire.TxOut,
|
||||||
feeRate chainfee.SatPerKWeight, minconf int32, label string) (*wire.MsgTx, error) {
|
feeRate chainfee.SatPerKWeight, minConfs int32, label string) (*wire.MsgTx, error) {
|
||||||
|
|
||||||
// Convert our fee rate from sat/kw to sat/kb since it's required by
|
// Convert our fee rate from sat/kw to sat/kb since it's required by
|
||||||
// SendOutputs.
|
// SendOutputs.
|
||||||
@ -495,13 +495,13 @@ func (b *BtcWallet) SendOutputs(outputs []*wire.TxOut,
|
|||||||
return nil, lnwallet.ErrNoOutputs
|
return nil, lnwallet.ErrNoOutputs
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanity check minconf.
|
// Sanity check minConfs.
|
||||||
if minconf < 0 {
|
if minConfs < 0 {
|
||||||
return nil, lnwallet.ErrInvalidMinconf
|
return nil, lnwallet.ErrInvalidMinconf
|
||||||
}
|
}
|
||||||
|
|
||||||
return b.wallet.SendOutputs(
|
return b.wallet.SendOutputs(
|
||||||
outputs, nil, defaultAccount, minconf, feeSatPerKB, label,
|
outputs, nil, defaultAccount, minConfs, feeSatPerKB, label,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,11 +608,11 @@ func (b *BtcWallet) ReleaseOutput(id wtxmgr.LockID, op wire.OutPoint) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ListUnspentWitness returns all unspent outputs which are version 0 witness
|
// ListUnspentWitness returns all unspent outputs which are version 0 witness
|
||||||
// programs. The 'minconfirms' and 'maxconfirms' parameters indicate the minimum
|
// programs. The 'minConfs' and 'maxConfs' parameters indicate the minimum
|
||||||
// and maximum number of confirmations an output needs in order to be returned
|
// and maximum number of confirmations an output needs in order to be returned
|
||||||
// by this method. Passing -1 as 'minconfirms' indicates that even unconfirmed
|
// by this method. Passing -1 as 'minConfs' indicates that even unconfirmed
|
||||||
// outputs should be returned. Using MaxInt32 as 'maxconfirms' implies returning
|
// outputs should be returned. Using MaxInt32 as 'maxConfs' implies returning
|
||||||
// all outputs with at least 'minconfirms'. The account parameter serves as a
|
// all outputs with at least 'minConfs'. The account parameter serves as a
|
||||||
// filter to retrieve the unspent outputs for a specific account. When empty,
|
// filter to retrieve the unspent outputs for a specific account. When empty,
|
||||||
// the unspent outputs of all wallet accounts are returned.
|
// the unspent outputs of all wallet accounts are returned.
|
||||||
//
|
//
|
||||||
|
@ -66,7 +66,7 @@ var (
|
|||||||
var ErrNoOutputs = errors.New("no outputs")
|
var ErrNoOutputs = errors.New("no outputs")
|
||||||
|
|
||||||
// ErrInvalidMinconf is returned if we try to create a transaction with
|
// ErrInvalidMinconf is returned if we try to create a transaction with
|
||||||
// invalid minconf value.
|
// invalid minConfs value.
|
||||||
var ErrInvalidMinconf = errors.New("minimum number of confirmations must " +
|
var ErrInvalidMinconf = errors.New("minimum number of confirmations must " +
|
||||||
"be a non-negative number")
|
"be a non-negative number")
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ type WalletController interface {
|
|||||||
//
|
//
|
||||||
// NOTE: This method requires the global coin selection lock to be held.
|
// NOTE: This method requires the global coin selection lock to be held.
|
||||||
SendOutputs(outputs []*wire.TxOut,
|
SendOutputs(outputs []*wire.TxOut,
|
||||||
feeRate chainfee.SatPerKWeight, minconf int32, label string) (*wire.MsgTx, error)
|
feeRate chainfee.SatPerKWeight, minConfs int32, label string) (*wire.MsgTx, error)
|
||||||
|
|
||||||
// CreateSimpleTx creates a Bitcoin transaction paying to the specified
|
// CreateSimpleTx creates a Bitcoin transaction paying to the specified
|
||||||
// outputs. The transaction is not broadcasted to the network. In the
|
// outputs. The transaction is not broadcasted to the network. In the
|
||||||
@ -254,17 +254,17 @@ type WalletController interface {
|
|||||||
dryRun bool) (*txauthor.AuthoredTx, error)
|
dryRun bool) (*txauthor.AuthoredTx, error)
|
||||||
|
|
||||||
// ListUnspentWitness returns all unspent outputs which are version 0
|
// ListUnspentWitness returns all unspent outputs which are version 0
|
||||||
// witness programs. The 'minconfirms' and 'maxconfirms' parameters
|
// witness programs. The 'minConfs' and 'maxConfs' parameters
|
||||||
// indicate the minimum and maximum number of confirmations an output
|
// indicate the minimum and maximum number of confirmations an output
|
||||||
// needs in order to be returned by this method. Passing -1 as
|
// needs in order to be returned by this method. Passing -1 as
|
||||||
// 'minconfirms' indicates that even unconfirmed outputs should be
|
// 'minConfs' indicates that even unconfirmed outputs should be
|
||||||
// returned. Using MaxInt32 as 'maxconfirms' implies returning all
|
// returned. Using MaxInt32 as 'maxConfs' implies returning all
|
||||||
// outputs with at least 'minconfirms'. The account parameter serves as
|
// outputs with at least 'minConfs'. The account parameter serves as
|
||||||
// a filter to retrieve the unspent outputs for a specific account.
|
// a filter to retrieve the unspent outputs for a specific account.
|
||||||
// When empty, the unspent outputs of all wallet accounts are returned.
|
// When empty, the unspent outputs of all wallet accounts are returned.
|
||||||
//
|
//
|
||||||
// NOTE: This method requires the global coin selection lock to be held.
|
// NOTE: This method requires the global coin selection lock to be held.
|
||||||
ListUnspentWitness(minconfirms, maxconfirms int32,
|
ListUnspentWitness(minConfs, maxConfs int32,
|
||||||
accountFilter string) ([]*Utxo, error)
|
accountFilter string) ([]*Utxo, error)
|
||||||
|
|
||||||
// ListTransactionDetails returns a list of all transactions which are
|
// ListTransactionDetails returns a list of all transactions which are
|
||||||
|
@ -964,7 +964,7 @@ func allowCORS(handler http.Handler, origins []string) http.Handler {
|
|||||||
// more addresses specified in the passed payment map. The payment map maps an
|
// more addresses specified in the passed payment map. The payment map maps an
|
||||||
// address to a specified output value to be sent to that address.
|
// address to a specified output value to be sent to that address.
|
||||||
func (r *rpcServer) sendCoinsOnChain(paymentMap map[string]int64,
|
func (r *rpcServer) sendCoinsOnChain(paymentMap map[string]int64,
|
||||||
feeRate chainfee.SatPerKWeight, minconf int32,
|
feeRate chainfee.SatPerKWeight, minConfs int32,
|
||||||
label string) (*chainhash.Hash, error) {
|
label string) (*chainhash.Hash, error) {
|
||||||
|
|
||||||
outputs, err := addrPairsToOutputs(paymentMap, r.cfg.ActiveNetParams.Params)
|
outputs, err := addrPairsToOutputs(paymentMap, r.cfg.ActiveNetParams.Params)
|
||||||
@ -989,7 +989,7 @@ func (r *rpcServer) sendCoinsOnChain(paymentMap map[string]int64,
|
|||||||
// If that checks out, we're failry confident that creating sending to
|
// If that checks out, we're failry confident that creating sending to
|
||||||
// these outputs will keep the wallet balance above the reserve.
|
// these outputs will keep the wallet balance above the reserve.
|
||||||
tx, err := r.server.cc.Wallet.SendOutputs(
|
tx, err := r.server.cc.Wallet.SendOutputs(
|
||||||
outputs, feeRate, minconf, label,
|
outputs, feeRate, minConfs, label,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -87,7 +87,7 @@ func (b *mockBackend) PublishTransaction(tx *wire.MsgTx, _ string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *mockBackend) ListUnspentWitnessFromDefaultAccount(minconfirms, maxconfirms int32) (
|
func (b *mockBackend) ListUnspentWitnessFromDefaultAccount(minConfs, maxConfs int32) (
|
||||||
[]*lnwallet.Utxo, error) {
|
[]*lnwallet.Utxo, error) {
|
||||||
b.lock.Lock()
|
b.lock.Lock()
|
||||||
defer b.lock.Unlock()
|
defer b.lock.Unlock()
|
||||||
|
@ -13,10 +13,10 @@ type Wallet interface {
|
|||||||
|
|
||||||
// ListUnspentWitnessFromDefaultAccount returns all unspent outputs
|
// ListUnspentWitnessFromDefaultAccount returns all unspent outputs
|
||||||
// which are version 0 witness programs from the default wallet account.
|
// which are version 0 witness programs from the default wallet account.
|
||||||
// The 'minconfirms' and 'maxconfirms' parameters indicate the minimum
|
// The 'minConfs' and 'maxConfs' parameters indicate the minimum
|
||||||
// and maximum number of confirmations an output needs in order to be
|
// and maximum number of confirmations an output needs in order to be
|
||||||
// returned by this method.
|
// returned by this method.
|
||||||
ListUnspentWitnessFromDefaultAccount(minconfirms, maxconfirms int32) (
|
ListUnspentWitnessFromDefaultAccount(minConfs, maxConfs int32) (
|
||||||
[]*lnwallet.Utxo, error)
|
[]*lnwallet.Utxo, error)
|
||||||
|
|
||||||
// WithCoinSelectLock will execute the passed function closure in a
|
// WithCoinSelectLock will execute the passed function closure in a
|
||||||
|
@ -112,7 +112,7 @@ type mockWallet struct {
|
|||||||
Wallet
|
Wallet
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockWallet) ListUnspentWitnessFromDefaultAccount(minconfirms, maxconfirms int32) (
|
func (m *mockWallet) ListUnspentWitnessFromDefaultAccount(minConfs, maxConfs int32) (
|
||||||
[]*lnwallet.Utxo, error) {
|
[]*lnwallet.Utxo, error) {
|
||||||
|
|
||||||
return []*lnwallet.Utxo{
|
return []*lnwallet.Utxo{
|
||||||
|
Loading…
Reference in New Issue
Block a user