Skip to content

Commit 53a8555

Browse files
committed
tapdb: parse delegation key field from DB when fetching seedling
Update seedling retrieval logic to parse the delegation key field from the database.
1 parent cc20763 commit 53a8555

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tapdb/asset_minting.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,31 @@ func fetchAssetSeedlings(ctx context.Context, q PendingAssetStore,
855855
}
856856
}
857857

858+
// If the seedling has a delegation key, we'll parse it and
859+
// store it in the seedling.
860+
if dbSeedling.DelegationKeyRaw != nil {
861+
delegationKeyPub, err := btcec.ParsePubKey(
862+
dbSeedling.DelegationKeyRaw,
863+
)
864+
if err != nil {
865+
return nil, err
866+
}
867+
868+
locator := keychain.KeyLocator{
869+
Index: extractSqlInt32[uint32](
870+
dbSeedling.DelegationKeyIndex,
871+
),
872+
Family: extractSqlInt32[keychain.KeyFamily](
873+
dbSeedling.DelegationKeyFam,
874+
),
875+
}
876+
877+
seedling.DelegationKey = fn.Some(keychain.KeyDescriptor{
878+
KeyLocator: locator,
879+
PubKey: delegationKeyPub,
880+
})
881+
}
882+
858883
if len(dbSeedling.GroupTapscriptRoot) != 0 {
859884
seedling.GroupTapscriptRoot = dbSeedling.
860885
GroupTapscriptRoot

0 commit comments

Comments
 (0)