public async Task <PoolFactoryBlock> CreatePoolFactoryBlockAsync() { // current leader need to create the pool factory var sb = await _sys.Storage.GetLastServiceBlockAsync(); var pf = new PoolFactoryBlock { Height = 1, AccountType = AccountTypes.PoolFactory, AccountID = PoolFactoryBlock.FactoryAccount, // in fact we not use this account. Balances = new Dictionary <string, long>(), PreviousHash = sb.Hash, ServiceHash = sb.Hash, Fee = 0, FeeType = AuthorizationFeeTypes.NoFee, FeeCode = LyraGlobal.OFFICIALTICKERCODE, }; pf.AddTag(Block.MANAGEDTAG, ""); // no othere variables. // pool blocks are service block so all service block signed by leader node pf.InitializeBlock(null, _sys.PosWallet.PrivateKey, AccountId: _sys.PosWallet.AccountId); return(pf); }
public ConsolidationBlock CreateConsolidationGenesisBlock(ServiceBlock svcGen, LyraTokenGenesisBlock lyraGen, PoolFactoryBlock pf) { var consBlock = new ConsolidationBlock { createdBy = ProtocolSettings.Default.StandbyValidators[0], blockHashes = new List <string>() { svcGen.Hash, lyraGen.Hash, pf.Hash }, totalBlockCount = 3 // not including self }; consBlock.TimeStamp = DateTime.UtcNow.AddSeconds(-18); var mt = new MerkleTree(); mt.AppendLeaf(MerkleHash.Create(svcGen.Hash)); mt.AppendLeaf(MerkleHash.Create(lyraGen.Hash)); mt.AppendLeaf(MerkleHash.Create(pf.Hash)); consBlock.MerkelTreeHash = mt.BuildTree().ToString(); consBlock.ServiceHash = svcGen.Hash; consBlock.totalFees = lyraGen.Fee.ToBalanceLong(); consBlock.InitializeBlock(null, _sys.PosWallet.PrivateKey, _sys.PosWallet.AccountId); return(consBlock); }