lnwallet: note requirement of global coin selection lock
This commit is contained in:
parent
c2f1fe26c1
commit
2a5b66ec00
@ -293,6 +293,8 @@ func (b *BtcWallet) IsOurAddress(a btcutil.Address) bool {
|
||||
// the specified outputs. In the case the wallet has insufficient funds, or the
|
||||
// outputs are non-standard, a non-nil error will be returned.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
//
|
||||
// This is a part of the WalletController interface.
|
||||
func (b *BtcWallet) SendOutputs(outputs []*wire.TxOut,
|
||||
feeRate chainfee.SatPerKWeight, label string) (*wire.MsgTx, error) {
|
||||
@ -321,6 +323,8 @@ func (b *BtcWallet) SendOutputs(outputs []*wire.TxOut,
|
||||
// NOTE: The dryRun argument can be set true to create a tx that doesn't alter
|
||||
// the database. A tx created with this set to true SHOULD NOT be broadcasted.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
//
|
||||
// This is a part of the WalletController interface.
|
||||
func (b *BtcWallet) CreateSimpleTx(outputs []*wire.TxOut,
|
||||
feeRate chainfee.SatPerKWeight, dryRun bool) (*txauthor.AuthoredTx, error) {
|
||||
@ -355,6 +359,8 @@ func (b *BtcWallet) CreateSimpleTx(outputs []*wire.TxOut,
|
||||
// avoid race conditions when selecting inputs for usage when funding a
|
||||
// channel.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
//
|
||||
// This is a part of the WalletController interface.
|
||||
func (b *BtcWallet) LockOutpoint(o wire.OutPoint) {
|
||||
b.wallet.LockOutpoint(o)
|
||||
@ -363,6 +369,8 @@ func (b *BtcWallet) LockOutpoint(o wire.OutPoint) {
|
||||
// UnlockOutpoint unlocks a previously locked output, marking it eligible for
|
||||
// coin selection.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
//
|
||||
// This is a part of the WalletController interface.
|
||||
func (b *BtcWallet) UnlockOutpoint(o wire.OutPoint) {
|
||||
b.wallet.UnlockOutpoint(o)
|
||||
@ -377,6 +385,8 @@ func (b *BtcWallet) UnlockOutpoint(o wire.OutPoint) {
|
||||
// If the output is not known, wtxmgr.ErrUnknownOutput is returned. If the
|
||||
// output has already been locked to a different ID, then
|
||||
// wtxmgr.ErrOutputAlreadyLocked is returned.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
func (b *BtcWallet) LeaseOutput(id wtxmgr.LockID, op wire.OutPoint) (time.Time,
|
||||
error) {
|
||||
|
||||
@ -392,6 +402,8 @@ func (b *BtcWallet) LeaseOutput(id wtxmgr.LockID, op wire.OutPoint) (time.Time,
|
||||
// ReleaseOutput unlocks an output, allowing it to be available for coin
|
||||
// selection if it remains unspent. The ID should match the one used to
|
||||
// originally lock the output.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
func (b *BtcWallet) ReleaseOutput(id wtxmgr.LockID, op wire.OutPoint) error {
|
||||
return b.wallet.ReleaseOutput(id, op)
|
||||
}
|
||||
@ -399,6 +411,8 @@ func (b *BtcWallet) ReleaseOutput(id wtxmgr.LockID, op wire.OutPoint) error {
|
||||
// ListUnspentWitness returns a slice of all the unspent outputs the wallet
|
||||
// controls which pay to witness programs either directly or indirectly.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
//
|
||||
// This is a part of the WalletController interface.
|
||||
func (b *BtcWallet) ListUnspentWitness(minConfs, maxConfs int32) (
|
||||
[]*lnwallet.Utxo, error) {
|
||||
|
@ -178,6 +178,8 @@ type WalletController interface {
|
||||
// funds, or the outputs are non-standard, an error should be returned.
|
||||
// This method also takes the target fee expressed in sat/kw that should
|
||||
// be used when crafting the transaction.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
SendOutputs(outputs []*wire.TxOut,
|
||||
feeRate chainfee.SatPerKWeight, label string) (*wire.MsgTx, error)
|
||||
|
||||
@ -191,6 +193,8 @@ type WalletController interface {
|
||||
// NOTE: The dryRun argument can be set true to create a tx that
|
||||
// doesn't alter the database. A tx created with this set to true
|
||||
// SHOULD NOT be broadcasted.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
CreateSimpleTx(outputs []*wire.TxOut, feeRate chainfee.SatPerKWeight,
|
||||
dryRun bool) (*txauthor.AuthoredTx, error)
|
||||
|
||||
@ -201,6 +205,8 @@ type WalletController interface {
|
||||
// 'minconfirms' indicates that even unconfirmed outputs should be
|
||||
// returned. Using MaxInt32 as 'maxconfirms' implies returning all
|
||||
// outputs with at least 'minconfirms'.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
ListUnspentWitness(minconfirms, maxconfirms int32) ([]*Utxo, error)
|
||||
|
||||
// ListTransactionDetails returns a list of all transactions which are
|
||||
@ -217,10 +223,14 @@ type WalletController interface {
|
||||
// be deemed as eligible for coin selection. Locking outputs are
|
||||
// utilized in order to avoid race conditions when selecting inputs for
|
||||
// usage when funding a channel.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
LockOutpoint(o wire.OutPoint)
|
||||
|
||||
// UnlockOutpoint unlocks a previously locked output, marking it
|
||||
// eligible for coin selection.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
UnlockOutpoint(o wire.OutPoint)
|
||||
|
||||
// LeaseOutput locks an output to the given ID, preventing it from being
|
||||
@ -232,11 +242,15 @@ type WalletController interface {
|
||||
// If the output is not known, wtxmgr.ErrUnknownOutput is returned. If
|
||||
// the output has already been locked to a different ID, then
|
||||
// wtxmgr.ErrOutputAlreadyLocked is returned.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
LeaseOutput(id wtxmgr.LockID, op wire.OutPoint) (time.Time, error)
|
||||
|
||||
// ReleaseOutput unlocks an output, allowing it to be available for coin
|
||||
// selection if it remains unspent. The ID should match the one used to
|
||||
// originally lock the output.
|
||||
//
|
||||
// NOTE: This method requires the global coin selection lock to be held.
|
||||
ReleaseOutput(id wtxmgr.LockID, op wire.OutPoint) error
|
||||
|
||||
// PublishTransaction performs cursory validation (dust checks, etc),
|
||||
|
Loading…
Reference in New Issue
Block a user