Fill DestAddresses in unmined transactions
This commit is contained in:
parent
0b070d7604
commit
f33df0928d
@ -556,6 +556,7 @@ func minedTransactionsToDetails(
|
|||||||
// for an unconfirmed transaction to a transaction detail.
|
// for an unconfirmed transaction to a transaction detail.
|
||||||
func unminedTransactionsToDetail(
|
func unminedTransactionsToDetail(
|
||||||
summary base.TransactionSummary,
|
summary base.TransactionSummary,
|
||||||
|
chainParams *chaincfg.Params,
|
||||||
) (*lnwallet.TransactionDetail, error) {
|
) (*lnwallet.TransactionDetail, error) {
|
||||||
|
|
||||||
wireTx := &wire.MsgTx{}
|
wireTx := &wire.MsgTx{}
|
||||||
@ -565,10 +566,22 @@ func unminedTransactionsToDetail(
|
|||||||
return nil, err
|
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{
|
txDetail := &lnwallet.TransactionDetail{
|
||||||
Hash: *summary.Hash,
|
Hash: *summary.Hash,
|
||||||
TotalFees: int64(summary.Fee),
|
TotalFees: int64(summary.Fee),
|
||||||
Timestamp: summary.Timestamp,
|
Timestamp: summary.Timestamp,
|
||||||
|
DestAddresses: destAddresses,
|
||||||
RawTx: summary.Transaction,
|
RawTx: summary.Transaction,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,7 +631,7 @@ func (b *BtcWallet) ListTransactionDetails() ([]*lnwallet.TransactionDetail, err
|
|||||||
txDetails = append(txDetails, details...)
|
txDetails = append(txDetails, details...)
|
||||||
}
|
}
|
||||||
for _, tx := range txns.UnminedTransactions {
|
for _, tx := range txns.UnminedTransactions {
|
||||||
detail, err := unminedTransactionsToDetail(tx)
|
detail, err := unminedTransactionsToDetail(tx, b.netParams)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -705,7 +718,9 @@ out:
|
|||||||
// notifications for any newly unconfirmed transactions.
|
// notifications for any newly unconfirmed transactions.
|
||||||
go func() {
|
go func() {
|
||||||
for _, tx := range txNtfn.UnminedTransactions {
|
for _, tx := range txNtfn.UnminedTransactions {
|
||||||
detail, err := unminedTransactionsToDetail(tx)
|
detail, err := unminedTransactionsToDetail(
|
||||||
|
tx, t.w.ChainParams(),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user