@@ -135,6 +135,7 @@ func (wme *WriteMarkerEntity) redeemMarker(ctx context.Context, startSeq int64)
135
135
}
136
136
137
137
var out , hash string
138
+ var nonce int64
138
139
txn := & transaction.Transaction {}
139
140
sn := & CommitConnection {}
140
141
sn .AllocationRoot = wme .WM .AllocationRoot
@@ -155,20 +156,21 @@ func (wme *WriteMarkerEntity) redeemMarker(ctx context.Context, startSeq int64)
155
156
156
157
if sn .AllocationRoot == sn .PrevAllocationRoot {
157
158
// 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 )
160
160
if err != nil {
161
161
wme .StatusMessage = "Error getting previous write marker. " + err .Error ()
162
162
if err := wme .UpdateStatus (ctx , Failed , "Error getting previous write marker. " + err .Error (), "" , startSeq , wme .Sequence ); err != nil {
163
163
Logger .Error ("WriteMarkerEntity_UpdateStatus" , zap .Error (err ))
164
164
}
165
165
return err
166
166
}
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
+
171
168
}
169
+
170
+ hash , out , nonce , txn , err = transaction .SmartContractTxn (STORAGE_CONTRACT_ADDRESS , transaction.SmartContractTxnData {
171
+ Name : CLOSE_CONNECTION_SC_NAME ,
172
+ InputArgs : sn ,
173
+ })
172
174
if err != nil {
173
175
Logger .Error ("Failed during sending close connection to the miner. " , zap .String ("err:" , err .Error ()))
174
176
wme .Status = Failed
@@ -180,7 +182,7 @@ func (wme *WriteMarkerEntity) redeemMarker(ctx context.Context, startSeq int64)
180
182
}
181
183
182
184
wme .CloseTxnID = txn .Hash
183
- wme .CloseTxnNonce = txn . TransactionNonce
185
+ wme .CloseTxnNonce = nonce
184
186
wme .Status = Committed
185
187
wme .StatusMessage = out
186
188
err = wme .UpdateStatus (ctx , Committed , out , hash , startSeq , wme .Sequence )
0 commit comments