(t *testing.T)
| 358 | } |
| 359 | |
| 360 | func TestSigBits(t *testing.T) { |
| 361 | ctx := context.Background() |
| 362 | |
| 363 | tpl := &Template{MaxTimeMS: bc.Millis(time.Now().Add(time.Minute))} |
| 364 | |
| 365 | pub, prv, err := ed25519.GenerateKey(nil) |
| 366 | if err != nil { |
| 367 | t.Fatal(err) |
| 368 | } |
| 369 | pubkeys := []ed25519.PublicKey{pub} |
| 370 | assetID := bc.NewHash(standard.AssetID(2, 1, pubkeys, nil)) |
| 371 | |
| 372 | tpl.AddIssuance(2, nil, nil, 1, [][]byte{{0}}, nil, pubkeys, 1, nil, nil) |
| 373 | tpl.AddOutput(0, nil, 1, assetID, nil, nil) |
| 374 | err = tpl.Sign(ctx, func(_ context.Context, msg []byte, keyID []byte, _ [][]byte) ([]byte, error) { |
| 375 | return ed25519.Sign(prv, msg), nil |
| 376 | }) |
| 377 | if err != nil { |
| 378 | t.Fatal(err) |
| 379 | } |
| 380 | _, err = tpl.Tx() |
| 381 | if err != nil { |
| 382 | t.Fatal(err) |
| 383 | } |
| 384 | for i := 0; i < len(tpl.Issuances[0].Sigs[0]); i++ { |
| 385 | for j := uint(0); j < 8; j++ { |
| 386 | tpl.Issuances[0].Sigs[0][i] ^= 1 << j |
| 387 | tpl.Dematerialize() |
| 388 | _, err = tpl.Tx() |
| 389 | if err == nil { |
| 390 | t.Errorf("got no error with twiddled bit %d", uint(8*i)+j) |
| 391 | } |
| 392 | tpl.Issuances[0].Sigs[0][i] ^= 1 << j // put it back the way it was |
| 393 | } |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | func TestMultisig(t *testing.T) { |
| 398 | ctx := context.Background() |
nothing calls this directly
no test coverage detected