lntest+lnwallet: remove the method FetchInputInfo
This method is no longer used. In addition, the `Derivation` field on the `Utxo` is also removed to avoid nil dereference.
This commit is contained in:
4 files changed
+1
-76
No files matched your search
@@ -43,21 +43,6 @@ func (w *WalletController) BackEnd() string {
|
|||||||
return "mock"
|
return "mock"
|
||||||
}
|
}
|
||||||
|
|
||||||
// FetchInputInfo will be called to get info about the inputs to the funding
|
|
||||||
// transaction.
|
|
||||||
func (w *WalletController) FetchInputInfo(
|
|
||||||
prevOut *wire.OutPoint) (*lnwallet.Utxo, error) {
|
|
||||||
|
|
||||||
utxo := &lnwallet.Utxo{
|
|
||||||
AddressType: lnwallet.WitnessPubKey,
|
|
||||||
Value: 10 * btcutil.SatoshiPerBitcoin,
|
|
||||||
PkScript: []byte("dummy"),
|
|
||||||
Confirmations: 1,
|
|
||||||
OutPoint: *prevOut,
|
|
||||||
}
|
|
||||||
return utxo, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// FetchOutpointInfo will be called to get info about the inputs to the funding
|
// FetchOutpointInfo will be called to get info about the inputs to the funding
|
||||||
// transaction.
|
// transaction.
|
||||||
func (w *WalletController) FetchOutpointInfo(
|
func (w *WalletController) FetchOutpointInfo(
|
||||||
|
|||||||
@@ -19,44 +19,6 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FetchInputInfo queries for the WalletController's knowledge of the passed
|
|
||||||
// outpoint. If the base wallet determines this output is under its control,
|
|
||||||
// then the original txout should be returned. Otherwise, a non-nil error value
|
|
||||||
// of ErrNotMine should be returned instead.
|
|
||||||
//
|
|
||||||
// This is a part of the WalletController interface.
|
|
||||||
func (b *BtcWallet) FetchInputInfo(prevOut *wire.OutPoint) (*lnwallet.Utxo,
|
|
||||||
error) {
|
|
||||||
|
|
||||||
prevTx, txOut, bip32, confirmations, err := b.wallet.FetchInputInfo(
|
|
||||||
prevOut,
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Then, we'll populate all of the information required by the struct.
|
|
||||||
addressType := lnwallet.UnknownAddressType
|
|
||||||
switch {
|
|
||||||
case txscript.IsPayToWitnessPubKeyHash(txOut.PkScript):
|
|
||||||
addressType = lnwallet.WitnessPubKey
|
|
||||||
case txscript.IsPayToScriptHash(txOut.PkScript):
|
|
||||||
addressType = lnwallet.NestedWitnessPubKey
|
|
||||||
case txscript.IsPayToTaproot(txOut.PkScript):
|
|
||||||
addressType = lnwallet.TaprootPubkey
|
|
||||||
}
|
|
||||||
|
|
||||||
return &lnwallet.Utxo{
|
|
||||||
AddressType: addressType,
|
|
||||||
Value: btcutil.Amount(txOut.Value),
|
|
||||||
PkScript: txOut.PkScript,
|
|
||||||
Confirmations: confirmations,
|
|
||||||
OutPoint: *prevOut,
|
|
||||||
Derivation: bip32,
|
|
||||||
PrevTx: prevTx,
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// FetchOutpointInfo queries for the WalletController's knowledge of the passed
|
// FetchOutpointInfo queries for the WalletController's knowledge of the passed
|
||||||
// outpoint. If the base wallet determines this output is under its control,
|
// outpoint. If the base wallet determines this output is under its control,
|
||||||
// then the original txout should be returned. Otherwise, a non-nil error value
|
// then the original txout should be returned. Otherwise, a non-nil error value
|
||||||
|
|||||||
@@ -126,8 +126,7 @@ type Utxo struct {
|
|||||||
Confirmations int64
|
Confirmations int64
|
||||||
PkScript []byte
|
PkScript []byte
|
||||||
wire.OutPoint
|
wire.OutPoint
|
||||||
Derivation *psbt.Bip32Derivation
|
PrevTx *wire.MsgTx
|
||||||
PrevTx *wire.MsgTx
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OutputDetail contains additional information on a destination address.
|
// OutputDetail contains additional information on a destination address.
|
||||||
@@ -227,11 +226,6 @@ type TransactionSubscription interface {
|
|||||||
// behavior of all interface methods in order to ensure identical behavior
|
// behavior of all interface methods in order to ensure identical behavior
|
||||||
// across all concrete implementations.
|
// across all concrete implementations.
|
||||||
type WalletController interface {
|
type WalletController interface {
|
||||||
// FetchInputInfo queries for the WalletController's knowledge of the
|
|
||||||
// passed outpoint. It returns the same info as `FetchOutpointInfo`
|
|
||||||
// plus the Bip32Derivation info.
|
|
||||||
FetchInputInfo(prevOut *wire.OutPoint) (*Utxo, error)
|
|
||||||
|
|
||||||
// FetchOutpointInfo queries for the WalletController's knowledge of
|
// FetchOutpointInfo queries for the WalletController's knowledge of
|
||||||
// the passed outpoint. If the base wallet determines this output is
|
// the passed outpoint. If the base wallet determines this output is
|
||||||
// under its control, then the original txout should be returned.
|
// under its control, then the original txout should be returned.
|
||||||
|
|||||||
@@ -45,22 +45,6 @@ func (w *mockWalletController) BackEnd() string {
|
|||||||
return "mock"
|
return "mock"
|
||||||
}
|
}
|
||||||
|
|
||||||
// FetchInputInfo will be called to get info about the inputs to the funding
|
|
||||||
// transaction.
|
|
||||||
func (w *mockWalletController) FetchInputInfo(
|
|
||||||
prevOut *wire.OutPoint) (*Utxo, error) {
|
|
||||||
|
|
||||||
utxo := &Utxo{
|
|
||||||
AddressType: WitnessPubKey,
|
|
||||||
Value: 10 * btcutil.SatoshiPerBitcoin,
|
|
||||||
PkScript: []byte("dummy"),
|
|
||||||
Confirmations: 1,
|
|
||||||
OutPoint: *prevOut,
|
|
||||||
}
|
|
||||||
|
|
||||||
return utxo, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// FetchOutpointInfo will be called to get info about the inputs to the funding
|
// FetchOutpointInfo will be called to get info about the inputs to the funding
|
||||||
// transaction.
|
// transaction.
|
||||||
func (w *mockWalletController) FetchOutpointInfo(
|
func (w *mockWalletController) FetchOutpointInfo(
|
||||||
|
|||||||
Reference in new issue
Block a user