github.com/decred/dcrlnd@v0.7.6/sweep/interface.go (about)

     1  package sweep
     2  
     3  import (
     4  	"github.com/decred/dcrd/chaincfg/chainhash"
     5  	"github.com/decred/dcrd/wire"
     6  	"github.com/decred/dcrlnd/lnwallet"
     7  )
     8  
     9  // Wallet contains all wallet related functionality required by sweeper.
    10  type Wallet interface {
    11  	// PublishTransaction performs cursory validation (dust checks, etc)
    12  	// and broadcasts the passed transaction to the Decred network.
    13  	PublishTransaction(tx *wire.MsgTx, label string) error
    14  
    15  	// AbandonDoubleSpends removes all unconfirmed transactions that also
    16  	// spend any of the specified outpoints from the wallet. This is used
    17  	// to fix issues when an input used in multiple different sweep
    18  	// transactions gets confirmed in one of them (rendering the other
    19  	// transactions invalid).
    20  	AbandonDoubleSpends(spentOutpoints ...*wire.OutPoint) error
    21  
    22  	// ListUnspentWitnessFromDefaultAccount returns all unspent outputs
    23  	// which are version 0 witness programs from the default wallet account.
    24  	// The 'minConfs' and 'maxConfs' parameters indicate the minimum
    25  	// and maximum number of confirmations an output needs in order to be
    26  	// returned by this method.
    27  	ListUnspentWitnessFromDefaultAccount(minConfs, maxConfs int32) (
    28  		[]*lnwallet.Utxo, error)
    29  
    30  	// WithCoinSelectLock will execute the passed function closure in a
    31  	// synchronized manner preventing any coin selection operations from
    32  	// proceeding while the closure is executing. This can be seen as the
    33  	// ability to execute a function closure under an exclusive coin
    34  	// selection lock.
    35  	WithCoinSelectLock(f func() error) error
    36  
    37  	// RemoveDescendants removes any wallet transactions that spends
    38  	// outputs created by the specified transaction.
    39  	RemoveDescendants(*wire.MsgTx) error
    40  
    41  	// FetchTx returns the transaction that corresponds to the transaction
    42  	// hash passed in. If the transaction can't be found then a nil
    43  	// transaction pointer is returned.
    44  	FetchTx(chainhash.Hash) (*wire.MsgTx, error)
    45  }