From 46a611cd90ae795f0caf8f2260f3f99df23d23a2 Mon Sep 17 00:00:00 2001 From: Yaacov Akiba Slama Date: Wed, 10 Jul 2019 09:40:41 +0300 Subject: [PATCH] Add DestAddresses field in transactions returned by SubscribeTransactions --- rpcserver.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index c2125daa..51396727 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -3576,6 +3576,10 @@ func (r *rpcServer) SubscribeTransactions(req *lnrpc.GetTransactionsRequest, for { select { case tx := <-txClient.ConfirmedTransactions(): + destAddresses := make([]string, 0, len(tx.DestAddresses)) + for _, destAddress := range tx.DestAddresses { + destAddresses = append(destAddresses, destAddress.EncodeAddress()) + } detail := &lnrpc.Transaction{ TxHash: tx.Hash.String(), Amount: int64(tx.Value), @@ -3583,6 +3587,7 @@ func (r *rpcServer) SubscribeTransactions(req *lnrpc.GetTransactionsRequest, BlockHash: tx.BlockHash.String(), TimeStamp: tx.Timestamp, TotalFees: tx.TotalFees, + DestAddresses: destAddresses, RawTxHex: hex.EncodeToString(tx.RawTx), } if err := updateStream.Send(detail); err != nil { @@ -3590,12 +3595,17 @@ func (r *rpcServer) SubscribeTransactions(req *lnrpc.GetTransactionsRequest, } case tx := <-txClient.UnconfirmedTransactions(): + var destAddresses []string + for _, destAddress := range tx.DestAddresses { + destAddresses = append(destAddresses, destAddress.EncodeAddress()) + } detail := &lnrpc.Transaction{ - TxHash: tx.Hash.String(), - Amount: int64(tx.Value), - TimeStamp: tx.Timestamp, - TotalFees: tx.TotalFees, - RawTxHex: hex.EncodeToString(tx.RawTx), + TxHash: tx.Hash.String(), + Amount: int64(tx.Value), + TimeStamp: tx.Timestamp, + TotalFees: tx.TotalFees, + DestAddresses: destAddresses, + RawTxHex: hex.EncodeToString(tx.RawTx), } if err := updateStream.Send(detail); err != nil { return err