lnwallet: add new DestOutputs field to TransactionDetail

A new `DestOutputs` field contains additional information on destinations of a transaction described with the `TransactionDetail` structure.

The additional information inside `DestOuputs` denote the output script and amount, as well as a flag `IsOurAddress` if the address is controlled by the node's wallet.
This commit is contained in:
Bjarne Magnussen 2021-07-09 17:49:51 +02:00
parent 42ca9b171e
commit cbf6bd9aca
No known key found for this signature in database
GPG Key ID: B0A9ADF6B24CE67F

View File

@ -12,6 +12,7 @@ import (
"github.com/btcsuite/btcd/btcutil/hdkeychain"
"github.com/btcsuite/btcd/btcutil/psbt"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcwallet/waddrmgr"
"github.com/btcsuite/btcwallet/wallet/txauthor"
@ -83,6 +84,16 @@ type Utxo struct {
PrevTx *wire.MsgTx
}
// OutputDetail contains additional information on a destination address.
type OutputDetail struct {
OutputType txscript.ScriptClass
Addresses []btcutil.Address
PkScript []byte
OutputIndex int
Value btcutil.Amount
IsOurAddress bool
}
// TransactionDetail describes a transaction with either inputs which belong to
// the wallet, or has outputs that pay to the wallet.
type TransactionDetail struct {
@ -120,6 +131,10 @@ type TransactionDetail struct {
// DestAddresses are the destinations for a transaction
DestAddresses []btcutil.Address
// OutputDetails contains output data for each destination address, such
// as the output script and amount.
OutputDetails []OutputDetail
// RawTx returns the raw serialized transaction.
RawTx []byte