Skip to content

Commit d978b4f

Browse files
committed
tapdb: extend NewMintingBatch query to support universe commitments
Update the NewMintingBatch SQL query to support setting the universe commitments flag. While the flag is currently set when the anchor transaction is assigned to the batch (i.e., during funding), this change adds the same support to CommitMintingBatch for completeness.
1 parent 85147f7 commit d978b4f

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

tapdb/asset_minting.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,10 @@ func (a *AssetMintingStore) CommitMintingBatch(ctx context.Context,
481481
// With our internal key inserted, we can now insert a new
482482
// batch which references the target internal key.
483483
if err := q.NewMintingBatch(ctx, MintingBatchInit{
484-
BatchID: batchID,
485-
HeightHint: int32(newBatch.HeightHint),
486-
CreationTimeUnix: newBatch.CreationTime.UTC(),
484+
BatchID: batchID,
485+
HeightHint: int32(newBatch.HeightHint),
486+
CreationTimeUnix: newBatch.CreationTime.UTC(),
487+
UniverseCommitments: newBatch.UniverseCommitments,
487488
}); err != nil {
488489
return fmt.Errorf("unable to insert minting "+
489490
"batch: %w", err)

tapdb/sqlc/assets.sql.go

Lines changed: 12 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tapdb/sqlc/queries/assets.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ RETURNING key_id;
1010

1111
-- name: NewMintingBatch :exec
1212
INSERT INTO asset_minting_batches (
13-
batch_state, batch_id, height_hint, creation_time_unix
14-
) VALUES (0, $1, $2, $3);
13+
batch_state, batch_id, height_hint, creation_time_unix, universe_commitments
14+
) VALUES (0, $1, $2, $3, $4);
1515

1616
-- name: FetchMintingBatchesByInverseState :many
1717
SELECT *

0 commit comments

Comments
 (0)