public void FundSideChain() { using (var context = new SidechainTestContext()) { context.StartSideNodes(); context.ConnectSideChainNodes(); context.EnableSideFedWallets(); // Wait for node to reach premine height TestHelper.WaitLoop(() => context.SideUser.FullNode.Chain.Height >= context.SideChainNetwork.Consensus.PremineHeight); TestHelper.WaitForNodeToSync(context.SideUser, context.FedSide1, context.FedSide2, context.FedSide3); // Ensure that coinbase contains premine reward and it goes to the fed. Block block = context.SideUser.FullNode.Chain.GetBlock((int)context.SideChainNetwork.Consensus.PremineHeight).Block; Transaction coinbase = block.Transactions[0]; Assert.Single(coinbase.Outputs); Assert.Equal(context.SideChainNetwork.Consensus.PremineReward, coinbase.Outputs[0].Value); Assert.Equal(context.scriptAndAddresses.payToMultiSig.PaymentScript, coinbase.Outputs[0].ScriptPubKey); } }
public async Task SideChainFedNodesBuildAndSync() { using (var context = new SidechainTestContext()) { context.StartSideNodes(); context.ConnectSideChainNodes(); context.EnableSideFedWallets(); // Wait for node to reach premine height await context.FedSide1.MineBlocksAsync((int)context.SideChainNetwork.Consensus.PremineHeight); TestHelper.WaitForNodeToSync(context.SideUser, context.FedSide1, context.FedSide2, context.FedSide3); // Ensure that coinbase contains premine reward and it goes to the fed. Block block = context.SideUser.FullNode.ChainIndexer.GetHeader((int)context.SideChainNetwork.Consensus.PremineHeight).Block; Transaction coinbase = block.Transactions[0]; Assert.Equal(FederatedPegBlockDefinition.FederationWalletOutputs, coinbase.Outputs.Count); for (int i = 0; i < FederatedPegBlockDefinition.FederationWalletOutputs; i++) { Assert.Equal(context.SideChainNetwork.Consensus.PremineReward / FederatedPegBlockDefinition.FederationWalletOutputs, coinbase.Outputs[i].Value); Assert.Equal(context.scriptAndAddresses.payToMultiSig.PaymentScript, coinbase.Outputs[i].ScriptPubKey); } } }