Merge pull request #1916 from guggero/crash-on-listchaintxns
rpcserver: handle unconfirmed TX properly when listing all transactions
This commit is contained in:
commit
9a3e19b77f
@ -3014,11 +3014,18 @@ func (r *rpcServer) GetTransactions(ctx context.Context,
|
|||||||
destAddresses = append(destAddresses, destAddress.EncodeAddress())
|
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{
|
txDetails.Transactions[i] = &lnrpc.Transaction{
|
||||||
TxHash: tx.Hash.String(),
|
TxHash: tx.Hash.String(),
|
||||||
Amount: int64(tx.Value),
|
Amount: int64(tx.Value),
|
||||||
NumConfirmations: tx.NumConfirmations,
|
NumConfirmations: tx.NumConfirmations,
|
||||||
BlockHash: tx.BlockHash.String(),
|
BlockHash: blockHash,
|
||||||
BlockHeight: tx.BlockHeight,
|
BlockHeight: tx.BlockHeight,
|
||||||
TimeStamp: tx.Timestamp,
|
TimeStamp: tx.Timestamp,
|
||||||
TotalFees: tx.TotalFees,
|
TotalFees: tx.TotalFees,
|
||||||
|
Loading…
Reference in New Issue
Block a user