(t *testing.T)
| 70 | } |
| 71 | |
| 72 | func TestCreateControlProgram(t *testing.T) { |
| 73 | // use pgtest.NewDB for deterministic postgres sequences |
| 74 | _, db := pgtest.NewDB(t, pgtest.SchemaPath) |
| 75 | m := NewManager(db, prottest.NewChain(t), nil) |
| 76 | ctx := context.Background() |
| 77 | |
| 78 | account, err := m.Create(ctx, []chainkd.XPub{testutil.TestXPub}, 1, "", nil, "") |
| 79 | if err != nil { |
| 80 | testutil.FatalErr(t, err) |
| 81 | } |
| 82 | |
| 83 | got, err := m.CreateControlProgram(ctx, account.ID, false, time.Now().Add(5*time.Minute)) |
| 84 | if err != nil { |
| 85 | testutil.FatalErr(t, err) |
| 86 | } |
| 87 | |
| 88 | want, err := vm.Assemble("DUP TOALTSTACK SHA3 0x6dbfeed3d0cffddbda105bfe320072b067304af099c9cff0251d5446412e524a 1 1 CHECKMULTISIG VERIFY FROMALTSTACK 0 CHECKPREDICATE") |
| 89 | if err != nil { |
| 90 | testutil.FatalErr(t, err) |
| 91 | } |
| 92 | |
| 93 | if !bytes.Equal(got, want) { |
| 94 | t.Errorf("got control program = %x want %x", got, want) |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | func (m *Manager) createTestAccount(ctx context.Context, t testing.TB, alias string, tags map[string]interface{}) *Account { |
| 99 | account, err := m.Create(ctx, []chainkd.XPub{testutil.TestXPub}, 1, alias, tags, "") |
nothing calls this directly
no test coverage detected