(asset, store, type)
| 662 | } |
| 663 | |
| 664 | function assertNoLocalReuseIdConflict(asset, store, type) { |
| 665 | if (!asset || !asset.id) return; |
| 666 | const local = findLocalAssetByTypeAndId(store, type, asset.id); |
| 667 | if (!local) return; |
| 668 | const incomingAssetId = asset.asset_id || computeAssetId(asset); |
| 669 | const localAssetId = local.asset_id || computeAssetId(local); |
| 670 | if (incomingAssetId !== localAssetId) { |
| 671 | throw new ContractError('internal_error', 'local asset id conflict'); |
| 672 | } |
| 673 | } |
| 674 | |
| 675 | function findLocalAssetByTypeAndId(store, type, id) { |
| 676 | const loader = type === 'Gene' ? store.loadGenes : store.loadCapsules; |
no test coverage detected