Skip to content

Commit 2cb8774

Browse files
author
Jayash
committed
Debug
1 parent 60adef9 commit 2cb8774

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

code/go/0chain.net/blobbercore/writemarker/protocol.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ func (wme *WriteMarkerEntity) redeemMarker(ctx context.Context, startSeq int64)
135135
}
136136

137137
var out, hash string
138+
var nonce int64
138139
txn := &transaction.Transaction{}
139140
sn := &CommitConnection{}
140141
sn.AllocationRoot = wme.WM.AllocationRoot
@@ -155,20 +156,21 @@ func (wme *WriteMarkerEntity) redeemMarker(ctx context.Context, startSeq int64)
155156

156157
if sn.AllocationRoot == sn.PrevAllocationRoot {
157158
// get nonce of prev WM
158-
var prevWM *WriteMarkerEntity
159-
prevWM, err = GetPreviousWM(ctx, sn.AllocationRoot, wme.WM.Timestamp)
159+
_, err = GetPreviousWM(ctx, sn.AllocationRoot, wme.WM.Timestamp)
160160
if err != nil {
161161
wme.StatusMessage = "Error getting previous write marker. " + err.Error()
162162
if err := wme.UpdateStatus(ctx, Failed, "Error getting previous write marker. "+err.Error(), "", startSeq, wme.Sequence); err != nil {
163163
Logger.Error("WriteMarkerEntity_UpdateStatus", zap.Error(err))
164164
}
165165
return err
166166
}
167-
hash, out, prevWM.CloseTxnNonce, txn, err = transaction.SmartContractTxn(STORAGE_CONTRACT_ADDRESS, transaction.SmartContractTxnData{
168-
Name: CLOSE_CONNECTION_SC_NAME,
169-
InputArgs: sn,
170-
})
167+
171168
}
169+
170+
hash, out, nonce, txn, err = transaction.SmartContractTxn(STORAGE_CONTRACT_ADDRESS, transaction.SmartContractTxnData{
171+
Name: CLOSE_CONNECTION_SC_NAME,
172+
InputArgs: sn,
173+
})
172174
if err != nil {
173175
Logger.Error("Failed during sending close connection to the miner. ", zap.String("err:", err.Error()))
174176
wme.Status = Failed
@@ -180,7 +182,7 @@ func (wme *WriteMarkerEntity) redeemMarker(ctx context.Context, startSeq int64)
180182
}
181183

182184
wme.CloseTxnID = txn.Hash
183-
wme.CloseTxnNonce = txn.TransactionNonce
185+
wme.CloseTxnNonce = nonce
184186
wme.Status = Committed
185187
wme.StatusMessage = out
186188
err = wme.UpdateStatus(ctx, Committed, out, hash, startSeq, wme.Sequence)

0 commit comments

Comments
 (0)