(ctx context.Context, b *txbuilder.TemplateBuilder)
| 185 | } |
| 186 | |
| 187 | func (a *controlAction) Build(ctx context.Context, b *txbuilder.TemplateBuilder) error { |
| 188 | var missing []string |
| 189 | if a.AccountID == "" { |
| 190 | missing = append(missing, "account_id") |
| 191 | } |
| 192 | if a.AssetId.IsZero() { |
| 193 | missing = append(missing, "asset_id") |
| 194 | } |
| 195 | if len(missing) > 0 { |
| 196 | return txbuilder.MissingFieldsError(missing...) |
| 197 | } |
| 198 | |
| 199 | // Produce a control program, but don't insert it into the database yet. |
| 200 | acp, err := a.accounts.createControlProgram(ctx, a.AccountID, false, b.MaxTime()) |
| 201 | if err != nil { |
| 202 | return err |
| 203 | } |
| 204 | a.accounts.insertControlProgramDelayed(ctx, b, acp) |
| 205 | |
| 206 | return b.AddOutput(legacy.NewTxOutput(*a.AssetId, a.Amount, acp.controlProgram, a.ReferenceData)) |
| 207 | } |
| 208 | |
| 209 | // insertControlProgramDelayed takes a template builder and an account |
| 210 | // control program that hasn't been inserted to the database yet. It |
nothing calls this directly
no test coverage detected