@@ -272,7 +272,7 @@ func (n *Notary) OnNewRequest(payload *payload.P2PNotaryRequest) {
272
272
// Avoid changes in the main transaction witnesses got from the notary request pool to
273
273
// keep the pooled tx valid. We will update its copy => the copy's size will be changed.
274
274
r = & request {
275
- main : safeCopy ( payload .MainTransaction ),
275
+ main : payload .MainTransaction . Copy ( ),
276
276
minNotValidBefore : nvbFallback ,
277
277
}
278
278
n .requests [payload .MainTransaction .Hash ()] = r
@@ -285,7 +285,7 @@ func (n *Notary) OnNewRequest(payload *payload.P2PNotaryRequest) {
285
285
// size won't be changed after finalisation, the witness bytes changes may
286
286
// affect the other users of notary pool and cause race. Avoid this by making
287
287
// the copy.
288
- r .fallbacks = append (r .fallbacks , safeCopy ( payload .FallbackTransaction ))
288
+ r .fallbacks = append (r .fallbacks , payload .FallbackTransaction . Copy ( ))
289
289
if exists && r .isMainCompleted () || validationErr != nil {
290
290
return
291
291
}
@@ -345,21 +345,6 @@ func (n *Notary) OnNewRequest(payload *payload.P2PNotaryRequest) {
345
345
}
346
346
}
347
347
348
- // safeCopy creates a copy of provided transaction by dereferencing it and creating
349
- // fresh witnesses so that the tx's witnesses may be modified without affecting the
350
- // copy's ones.
351
- func safeCopy (tx * transaction.Transaction ) * transaction.Transaction {
352
- cp := * tx
353
- cp .Scripts = make ([]transaction.Witness , len (tx .Scripts ))
354
- for i := range cp .Scripts {
355
- cp .Scripts [i ] = transaction.Witness {
356
- InvocationScript : bytes .Clone (tx .Scripts [i ].InvocationScript ),
357
- VerificationScript : bytes .Clone (tx .Scripts [i ].VerificationScript ),
358
- }
359
- }
360
- return & cp
361
- }
362
-
363
348
// OnRequestRemoval is a callback which is called after fallback transaction is removed
364
349
// from the notary payload pool due to expiration, main tx appliance or any other reason.
365
350
func (n * Notary ) OnRequestRemoval (pld * payload.P2PNotaryRequest ) {
0 commit comments