From 9bb45912dc91c47a27e12f7edc82ce13d056d4e2 Mon Sep 17 00:00:00 2001 From: anandrgitnirman Date: Fri, 27 Mar 2020 11:07:52 +0530 Subject: [PATCH] #481 Send the Expiry of the channel ( even for List in Progress) , the Channel's expiry should always be taken from the latest block chain state --- escrow/control_service.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/escrow/control_service.go b/escrow/control_service.go index 438bc00e..d53d3bf2 100644 --- a/escrow/control_service.go +++ b/escrow/control_service.go @@ -234,16 +234,23 @@ func (service *ProviderControlService) listClaims() (*PaymentsListReply, error) output := make([]*PaymentReply, 0) for _, claimRetrieved := range claimsRetrieved { payment := claimRetrieved.Payment() + //To Get the Expiration of the Channel ( always get the latest state) + latestChannel, ok, err := service.channelService.PaymentChannel(&PaymentChannelKey{ID: payment.ChannelID}) + if !ok || err != nil { + log.Errorf("Unable to retrieve the latest Channel State", payment.ChannelID, payment.ChannelNonce) + continue + } if payment.Signature == nil || payment.Amount.Int64() == 0 { log.Errorf("The Signature or the Amount is not defined on the Payment with"+ " Channel Id:%v , Nonce:%v", payment.ChannelID, payment.ChannelNonce) continue } paymentReply := &PaymentReply{ - ChannelId: bigIntToBytes(payment.ChannelID), - ChannelNonce: bigIntToBytes(payment.ChannelNonce), - SignedAmount: bigIntToBytes(payment.Amount), - Signature: payment.Signature, + ChannelId: bigIntToBytes(payment.ChannelID), + ChannelNonce: bigIntToBytes(payment.ChannelNonce), + SignedAmount: bigIntToBytes(payment.Amount), + Signature: payment.Signature, + ChannelExpiry: bigIntToBytes(latestChannel.Expiration), } output = append(output, paymentReply) }