From 90a2e0846c3e57b65aa512c398cfff2579f48493 Mon Sep 17 00:00:00 2001 From: Alexey Zhunin Date: Fri, 4 Sep 2020 15:02:10 +0300 Subject: [PATCH] MN-761: use TransferToDeposit request reference as txID (#76) --- application/builtin/contract/deposit/deposit.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/application/builtin/contract/deposit/deposit.go b/application/builtin/contract/deposit/deposit.go index e4c3336..973d6e2 100644 --- a/application/builtin/contract/deposit/deposit.go +++ b/application/builtin/contract/deposit/deposit.go @@ -261,10 +261,19 @@ func (d *Deposit) TransferToDeposit( } d.Balance = newBalance.String() destination := deposit.GetObject(toDeposit) + + // We will use the reference of the current request as the transaction ID. + txID, err := foundation.GetRequestReference() + if err != nil { + return errors.Wrap(err, "failed to get current request reference") + } + if txID == nil { + return errors.New("invalid logical context. request reference is nil") + } acceptDepositErr := destination.Accept(appfoundation.SagaAcceptInfo{ Amount: amountStr, FromMember: fromMember, - Request: request, + Request: *txID, }) if acceptDepositErr == nil { return nil