From cbf6bd9acad46fb07263db7ea532af85ef629add Mon Sep 17 00:00:00 2001 From: Bjarne Magnussen Date: Fri, 9 Jul 2021 17:49:51 +0200 Subject: [PATCH] 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. --- lnwallet/interface.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lnwallet/interface.go b/lnwallet/interface.go index c74573c2d..423c59ecd 100644 --- a/lnwallet/interface.go +++ b/lnwallet/interface.go @@ -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