lnrpc: add previous_outpoints to listchaintxns

This commit is contained in:
priyanshiiit committed 2022-06-27 15:57:57 +05:30
1 parent 61493a5f29
commit 983d917d4a
5 files changed
+4014 -3861

No files matched your search

+20 -11
View File
@@ -45,6 +45,14 @@ func RPCTransaction(tx *lnwallet.TransactionDetail) *Transaction {
})
}
previousOutpoints := make([]*PreviousOutPoint, len(tx.PreviousOutpoints))
for idx, previousOutPoint := range tx.PreviousOutpoints {
previousOutpoints[idx] = &PreviousOutPoint{
Outpoint: previousOutPoint.OutPoint,
IsOurOutput: previousOutPoint.IsOurOutput,
}
}
// We also get unconfirmed transactions, so BlockHash can be nil.
blockHash := ""
if tx.BlockHash != nil {
@@ -52,17 +60,18 @@ func RPCTransaction(tx *lnwallet.TransactionDetail) *Transaction {
}
return &Transaction{
TxHash: tx.Hash.String(),
Amount: int64(tx.Value),
NumConfirmations: tx.NumConfirmations,
BlockHash: blockHash,
BlockHeight: tx.BlockHeight,
TimeStamp: tx.Timestamp,
TotalFees: tx.TotalFees,
DestAddresses: destAddresses,
OutputDetails: outputDetails,
RawTxHex: hex.EncodeToString(tx.RawTx),
Label: tx.Label,
TxHash: tx.Hash.String(),
Amount: int64(tx.Value),
NumConfirmations: tx.NumConfirmations,
BlockHash: blockHash,
BlockHeight: tx.BlockHeight,
TimeStamp: tx.Timestamp,
TotalFees: tx.TotalFees,
DestAddresses: destAddresses,
OutputDetails: outputDetails,
RawTxHex: hex.EncodeToString(tx.RawTx),
Label: tx.Label,
PreviousOutpoints: previousOutpoints,
}
}