taproot-assets icon indicating copy to clipboard operation
taproot-assets copied to clipboard

QoL changes for AssetCommitments

Open jharveyb opened this issue 1 year ago • 1 comments

Brought up by @ffranr while reviewing lightninglabs/tap#52:

  • [x] We should probably store the asset type of the assets in an AssetCommitment, as part of the commitment struct itself, similar to the AssetID or group key. This helps prevent insertion of assets that have a mismatched group key set, which should never happen in practice. Right now the type is looked up by checking against a random asset in the backing CommittedAssets map, which would be overkill in the case of many upserts.

  • [ ] We may also want to consider a batched version of Upsert that accepts multiple assets and reuses some of the logic is parseCommon.

  • [ ] Lastly, an IsEqual method for both commitment types would be useful - I think right now we write this manually by computing the tree root and comparing those.

jharveyb avatar Apr 25 '23 14:04 jharveyb

commitment: add asset type field to asset commitment structure: https://github.com/lightninglabs/taproot-assets/pull/278

ffranr avatar May 16 '23 17:05 ffranr