lnwallet: add raw tx hex attribute to ListTransactionDetails

This commit is contained in:
Olaoluwa Osuntokun 2019-06-07 07:36:20 -07:00
parent 52b7603d25
commit eaf86cc4f9
No known key found for this signature in database
GPG Key ID: CE58F7F8E20FD9A2
2 changed files with 10 additions and 3 deletions

@ -512,8 +512,9 @@ func minedTransactionsToDetails(
var destAddresses []btcutil.Address var destAddresses []btcutil.Address
for _, txOut := range wireTx.TxOut { for _, txOut := range wireTx.TxOut {
_, outAddresses, _, err := _, outAddresses, _, err := txscript.ExtractPkScriptAddrs(
txscript.ExtractPkScriptAddrs(txOut.PkScript, chainParams) txOut.PkScript, chainParams,
)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -529,6 +530,7 @@ func minedTransactionsToDetails(
Timestamp: block.Timestamp, Timestamp: block.Timestamp,
TotalFees: int64(tx.Fee), TotalFees: int64(tx.Fee),
DestAddresses: destAddresses, DestAddresses: destAddresses,
RawTx: tx.Transaction,
} }
balanceDelta, err := extractBalanceDelta(tx, wireTx) balanceDelta, err := extractBalanceDelta(tx, wireTx)
@ -597,7 +599,9 @@ func (b *BtcWallet) ListTransactionDetails() ([]*lnwallet.TransactionDetail, err
// TransactionDetail which re-packages the data returned by the base // TransactionDetail which re-packages the data returned by the base
// wallet. // wallet.
for _, blockPackage := range txns.MinedTransactions { for _, blockPackage := range txns.MinedTransactions {
details, err := minedTransactionsToDetails(currentHeight, blockPackage, b.netParams) details, err := minedTransactionsToDetails(
currentHeight, blockPackage, b.netParams,
)
if err != nil { if err != nil {
return nil, err return nil, err
} }

@ -100,6 +100,9 @@ type TransactionDetail struct {
// DestAddresses are the destinations for a transaction // DestAddresses are the destinations for a transaction
DestAddresses []btcutil.Address DestAddresses []btcutil.Address
// RawTx returns the raw serialized transaction.
RawTx []byte
} }
// TransactionSubscription is an interface which describes an object capable of // TransactionSubscription is an interface which describes an object capable of