lnwallet: expose output leases on WalletController interface

This commit is contained in:
Wilmer Paulino
2020-05-20 15:33:56 -07:00
parent 94629b6c73
commit ae7335ce3b
3 changed files with 50 additions and 0 deletions

View File

@@ -4,12 +4,14 @@ import (
"errors"
"fmt"
"sync"
"time"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/btcsuite/btcwallet/wallet/txauthor"
"github.com/btcsuite/btcwallet/wtxmgr"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
)
@@ -221,6 +223,22 @@ type WalletController interface {
// eligible for coin selection.
UnlockOutpoint(o wire.OutPoint)
// LeaseOutput locks an output to the given ID, preventing it from being
// available for any future coin selection attempts. The absolute time
// of the lock's expiration is returned. The expiration of the lock can
// be extended by successive invocations of this call. Outputs can be
// unlocked before their expiration through `ReleaseOutput`.
//
// 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.
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.
ReleaseOutput(id wtxmgr.LockID, op wire.OutPoint) error
// PublishTransaction performs cursory validation (dust checks, etc),
// then finally broadcasts the passed transaction to the Bitcoin network.
// If the transaction is rejected because it is conflicting with an