MCPcopy Create free account
hub / github.com/chain/Core / CreateControlProgram

Method CreateControlProgram

core/account/accounts.go:274–284  ·  view source on GitHub ↗

CreateControlProgram creates a control program that is tied to the Account and stores it in the database.

(ctx context.Context, accountID string, change bool, expiresAt time.Time)

Source from the content-addressed store, hash-verified

272// CreateControlProgram creates a control program
273// that is tied to the Account and stores it in the database.
274func (m *Manager) CreateControlProgram(ctx context.Context, accountID string, change bool, expiresAt time.Time) ([]byte, error) {
275 cp, err := m.createControlProgram(ctx, accountID, change, expiresAt)
276 if err != nil {
277 return nil, err
278 }
279 err = m.insertAccountControlProgram(ctx, cp)
280 if err != nil {
281 return nil, err
282 }
283 return cp.controlProgram, nil
284}
285
286func (m *Manager) insertAccountControlProgram(ctx context.Context, progs ...*controlProgram) error {
287 const q = `

Callers 3

CreateReceiverMethod · 0.95
TestCreateControlProgramFunction · 0.95

Calls 2

createControlProgramMethod · 0.95

Tested by 1

TestCreateControlProgramFunction · 0.76