rpcserver: handle unconfirmed TX properly when listing all transactions

This commit is contained in:
Oliver Gugger 2018-09-15 11:07:27 +02:00
parent 3b2c807288
commit 10b976187d
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

View File

@ -3014,11 +3014,18 @@ func (r *rpcServer) GetTransactions(ctx context.Context,
destAddresses = append(destAddresses, destAddress.EncodeAddress())
}
// We also get unconfirmed transactions, so BlockHash can be
// nil.
blockHash := ""
if tx.BlockHash != nil {
blockHash = tx.BlockHash.String()
}
txDetails.Transactions[i] = &lnrpc.Transaction{
TxHash: tx.Hash.String(),
Amount: int64(tx.Value),
NumConfirmations: tx.NumConfirmations,
BlockHash: tx.BlockHash.String(),
BlockHash: blockHash,
BlockHeight: tx.BlockHeight,
TimeStamp: tx.Timestamp,
TotalFees: tx.TotalFees,