-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mintrpc+tapgarden: add universe announcement flag to asset minting #1173
base: main
Are you sure you want to change the base?
Changes from all commits
84fad33
2776dba
74c1c50
add3531
8207a69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,12 @@ type MintingBatch struct { | |
// reveal for that asset, if it has one. | ||
AssetMetas AssetMetas | ||
|
||
// EnableUniAnnounce is a flag that indicates whether the minting | ||
// event should support universe announcements. If set to true, | ||
// the batch must include only assets that share the same asset group | ||
// key, which must also be set. | ||
EnableUniAnnounce bool | ||
|
||
// mintingPubKey is the top-level Taproot output key that will be used | ||
// to commit to the Taproot Asset commitment above. | ||
mintingPubKey *btcec.PublicKey | ||
|
@@ -309,6 +315,35 @@ func (m *MintingBatch) HasSeedlings() bool { | |
return len(m.Seedlings) != 0 | ||
} | ||
|
||
// ValidateSeedling checks if a seedling is valid for the batch. | ||
func (m *MintingBatch) ValidateSeedling(newSeedling Seedling) error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIUC we want this to be a logical AND between this flag for each seedling, and the matching flag for the batch. So the first seedling of the batch should update the batch flag, and every other seedling should match. This implies that every seedling would have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's what I'm going for. |
||
// Ensure that the seedling and batch agree on the enabled universe | ||
// announcements. | ||
if m.EnableUniAnnounce != newSeedling.EnableUniAnnounce { | ||
return fmt.Errorf("batch and seedling do not agree on " + | ||
"enabled universe announcements") | ||
} | ||
|
||
// If the seedling supports universe announcements, it must have a group | ||
// anchor or the same group key as all the other seedlings in the batch. | ||
if newSeedling.EnableUniAnnounce { | ||
ffranr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if newSeedling.GroupAnchor == nil && | ||
newSeedling.GroupInfo == nil { | ||
|
||
return fmt.Errorf("universe announcement enabled for " + | ||
"seedling but group info/anchor is absent") | ||
} | ||
|
||
if newSeedling.GroupInfo != nil { | ||
// TODO(ffranr): Add check to ensure that this new | ||
// seedling has the same group key as the other | ||
// seedlings in the batch. | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// ToMintingBatch creates a new MintingBatch from a VerboseBatch. | ||
func (v *VerboseBatch) ToMintingBatch() *MintingBatch { | ||
newBatch := v.MintingBatch.Copy() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't have the same meaning as before.
specificGroupInternalKey
wastrue
if the seedling is being minted into an existing group.GroupInternalKey
is only non-nil if you are creating a new group, and you want to use a specific internal key instead of whichever keytapd
will generate automatically.