@@ -10,6 +10,7 @@ import (
10
10
"fmt"
11
11
"math/big"
12
12
"sort"
13
+ "strings"
13
14
"sync"
14
15
15
16
"github.com/btcsuite/btcd/btcec/v2"
@@ -155,6 +156,10 @@ func ComputeTweaksForBlockV3(block *types.Block) ([]types.Tweak, error) {
155
156
}(batch )
156
157
}
157
158
159
+ if errG != nil {
160
+ panic (errG )
161
+ }
162
+
158
163
wg .Wait ()
159
164
return tweaks , nil
160
165
}
@@ -217,11 +222,15 @@ func ComputeTweaksForBlockV2(block *types.Block) ([]types.Tweak, error) {
217
222
}(tx )
218
223
}
219
224
225
+ if errG != nil {
226
+ panic (errG )
227
+ }
220
228
wg .Wait ()
221
229
//common.InfoLogger.Println("Tweaks computed...")
222
230
return tweaks , nil
223
231
}
224
232
233
+ // Deprecated: slowest of them all, do not use anywhere
225
234
func ComputeTweaksForBlockV1 (block * types.Block ) ([]types.Tweak , error ) {
226
235
//common.InfoLogger.Println("Computing tweaks...")
227
236
var tweaks []types.Tweak
@@ -260,6 +269,10 @@ func ComputeTweakPerTx(tx types.Transaction) (*types.Tweak, error) {
260
269
}
261
270
summedKey , err := sumPublicKeys (pubKeys )
262
271
if err != nil {
272
+ if strings .Contains (err .Error (), "not on secp256k1 curve" ) {
273
+ common .WarningLogger .Println (err )
274
+ return nil , nil
275
+ }
263
276
common .DebugLogger .Println ("tx:" , tx .Txid )
264
277
common .ErrorLogger .Println (err )
265
278
return nil , err
@@ -459,7 +472,6 @@ func sumPublicKeys(pubKeys []string) (*btcec.PublicKey, error) {
459
472
if err != nil {
460
473
common .ErrorLogger .Println (err )
461
474
// todo remove panics
462
- panic (err )
463
475
return nil , err
464
476
}
465
477
@@ -471,7 +483,6 @@ func sumPublicKeys(pubKeys []string) (*btcec.PublicKey, error) {
471
483
publicKey , err := btcec .ParsePubKey (bytesPubKey )
472
484
if err != nil {
473
485
common .ErrorLogger .Println (err )
474
- panic (err )
475
486
return nil , err
476
487
}
477
488
@@ -489,14 +500,12 @@ func sumPublicKeys(pubKeys []string) (*btcec.PublicKey, error) {
489
500
decodeString , err = hex .DecodeString (fmt .Sprintf ("04%s%s" , sX , sY ))
490
501
if err != nil {
491
502
common .ErrorLogger .Println (err )
492
- panic (err )
493
503
return nil , err
494
504
}
495
505
496
506
lastPubKey , err = btcec .ParsePubKey (decodeString )
497
507
if err != nil {
498
508
common .ErrorLogger .Println (err )
499
- panic (err )
500
509
return nil , err
501
510
}
502
511
}
0 commit comments