sweep: create wallet interface
We need access to additional wallet functionality. This commit creates an interface to prevent passing in multiple function pointers.
This commit is contained in:
5 files changed
+43
-23
No files matched your search
+4
-5
@@ -210,9 +210,8 @@ type UtxoSweeperConfig struct {
|
||||
// transaction.
|
||||
FeeEstimator chainfee.Estimator
|
||||
|
||||
// PublishTransaction facilitates the process of broadcasting a signed
|
||||
// transaction to the appropriate network.
|
||||
PublishTransaction func(*wire.MsgTx) error
|
||||
// Wallet contains the wallet functions that sweeper requires.
|
||||
Wallet Wallet
|
||||
|
||||
// NewBatchTimer creates a channel that will be sent on when a certain
|
||||
// time window has passed. During this time window, new inputs can still
|
||||
@@ -321,7 +320,7 @@ func (s *UtxoSweeper) Start() error {
|
||||
|
||||
// Error can be ignored. Because we are starting up, there are
|
||||
// no pending inputs to update based on the publish result.
|
||||
err := s.cfg.PublishTransaction(lastTx)
|
||||
err := s.cfg.Wallet.PublishTransaction(lastTx)
|
||||
if err != nil && err != lnwallet.ErrDoubleSpend {
|
||||
log.Errorf("last tx publish: %v", err)
|
||||
}
|
||||
@@ -886,7 +885,7 @@ func (s *UtxoSweeper) sweep(inputs inputSet, feeRate chainfee.SatPerKWeight,
|
||||
}),
|
||||
)
|
||||
|
||||
err = s.cfg.PublishTransaction(tx)
|
||||
err = s.cfg.Wallet.PublishTransaction(tx)
|
||||
|
||||
// In case of an unexpected error, don't try to recover.
|
||||
if err != nil && err != lnwallet.ErrDoubleSpend {
|
||||
|
||||
Reference in new issue
Block a user