lnwallet: expose output leases on WalletController interface
This commit is contained in:
3 files changed
+50
No files matched your search
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/btcsuite/btcwallet/wallet/txauthor"
|
||||
"github.com/btcsuite/btcwallet/wallet/txrules"
|
||||
"github.com/btcsuite/btcwallet/walletdb"
|
||||
"github.com/btcsuite/btcwallet/wtxmgr"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
@@ -367,6 +368,27 @@ func (b *BtcWallet) UnlockOutpoint(o wire.OutPoint) {
|
||||
b.wallet.UnlockOutpoint(o)
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (b *BtcWallet) LeaseOutput(id wtxmgr.LockID, op wire.OutPoint) (time.Time,
|
||||
error) {
|
||||
return b.wallet.LeaseOutput(id, op)
|
||||
}
|
||||
|
||||
// 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.
|
||||
func (b *BtcWallet) ReleaseOutput(id wtxmgr.LockID, op wire.OutPoint) error {
|
||||
return b.wallet.ReleaseOutput(id, op)
|
||||
}
|
||||
|
||||
// ListUnspentWitness returns a slice of all the unspent outputs the wallet
|
||||
// controls which pay to witness programs either directly or indirectly.
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user