Add an issuance transaction to the genesis block. Typically used to pre-issue * the policyAsset of a blockchain. The genesis block is not actually validated, * so this transaction simply has to match issuance structure. */
| 67 | * the policyAsset of a blockchain. The genesis block is not actually validated, |
| 68 | * so this transaction simply has to match issuance structure. */ |
| 69 | void AppendInitialIssuance(CBlock& genesis_block, const COutPoint& prevout, const uint256& contract, const int64_t asset_outputs, const int64_t asset_values, const int64_t reissuance_outputs, const int64_t reissuance_values, const CScript& issuance_destination) { |
| 70 | uint256 entropy; |
| 71 | GenerateAssetEntropy(entropy, prevout, contract); |
| 72 | |
| 73 | CAsset asset; |
| 74 | CalculateAsset(asset, entropy); |
| 75 | |
| 76 | // Re-issuance of policyAsset is always unblinded |
| 77 | CAsset reissuance; |
| 78 | CalculateReissuanceToken(reissuance, entropy, false); |
| 79 | |
| 80 | // Note: Genesis block isn't actually validated, outputs are entered into utxo db only |
| 81 | CMutableTransaction txNew; |
| 82 | txNew.nVersion = 1; |
| 83 | txNew.vin.resize(1); |
| 84 | txNew.vin[0].prevout = prevout; |
| 85 | txNew.vin[0].assetIssuance.assetEntropy = contract; |
| 86 | txNew.vin[0].assetIssuance.nAmount = CConfidentialValue(asset_values * asset_outputs); |
| 87 | txNew.vin[0].assetIssuance.nInflationKeys = CConfidentialValue(reissuance_values * reissuance_outputs); |
| 88 | |
| 89 | for (unsigned int i = 0; i < asset_outputs; i++) { |
| 90 | txNew.vout.push_back(CTxOut(asset, CConfidentialValue(asset_values), issuance_destination)); |
| 91 | } |
| 92 | for (unsigned int i = 0; i < reissuance_outputs; i++) { |
| 93 | txNew.vout.push_back(CTxOut(reissuance, CConfidentialValue(reissuance_values), issuance_destination)); |
| 94 | } |
| 95 | |
| 96 | genesis_block.vtx.push_back(MakeTransactionRef(std::move(txNew))); |
| 97 | genesis_block.hashMerkleRoot = BlockMerkleRoot(genesis_block); |
| 98 | } |
no test coverage detected