Fill DestAddresses in unmined transactions
This commit is contained in:
1 parent
0b070d7604
commit
f33df0928d
1 file changed
+21
-6
@@ -556,6 +556,7 @@ func minedTransactionsToDetails(
|
||||
// for an unconfirmed transaction to a transaction detail.
|
||||
func unminedTransactionsToDetail(
|
||||
summary base.TransactionSummary,
|
||||
chainParams *chaincfg.Params,
|
||||
) (*lnwallet.TransactionDetail, error) {
|
||||
|
||||
wireTx := &wire.MsgTx{}
|
||||
@@ -565,11 +566,23 @@ func unminedTransactionsToDetail(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var destAddresses []btcutil.Address
|
||||
for _, txOut := range wireTx.TxOut {
|
||||
_, outAddresses, _, err :=
|
||||
txscript.ExtractPkScriptAddrs(txOut.PkScript, chainParams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
destAddresses = append(destAddresses, outAddresses...)
|
||||
}
|
||||
|
||||
txDetail := &lnwallet.TransactionDetail{
|
||||
Hash: *summary.Hash,
|
||||
TotalFees: int64(summary.Fee),
|
||||
Timestamp: summary.Timestamp,
|
||||
RawTx: summary.Transaction,
|
||||
Hash: *summary.Hash,
|
||||
TotalFees: int64(summary.Fee),
|
||||
Timestamp: summary.Timestamp,
|
||||
DestAddresses: destAddresses,
|
||||
RawTx: summary.Transaction,
|
||||
}
|
||||
|
||||
balanceDelta, err := extractBalanceDelta(summary, wireTx)
|
||||
@@ -618,7 +631,7 @@ func (b *BtcWallet) ListTransactionDetails() ([]*lnwallet.TransactionDetail, err
|
||||
txDetails = append(txDetails, details...)
|
||||
}
|
||||
for _, tx := range txns.UnminedTransactions {
|
||||
detail, err := unminedTransactionsToDetail(tx)
|
||||
detail, err := unminedTransactionsToDetail(tx, b.netParams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -705,7 +718,9 @@ out:
|
||||
// notifications for any newly unconfirmed transactions.
|
||||
go func() {
|
||||
for _, tx := range txNtfn.UnminedTransactions {
|
||||
detail, err := unminedTransactionsToDetail(tx)
|
||||
detail, err := unminedTransactionsToDetail(
|
||||
tx, t.w.ChainParams(),
|
||||
)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user