private static async Task <Block> MineAMutatedBlockAsync(TestChainContext context) { List <Block> blocks = await TestChainFactory.MineBlocksWithLastBlockMutatedAsync(context, 1, MinerScriptPubKey); Block block = blocks.Last(); return(block); }
private static async Task <Block> Mine2BlocksAndCreateABlockWithBadPrevHashAsync(TestChainContext context) { List <Block> blocks = await TestChainFactory.MineBlocksAsync(context, 2, MinerScriptPubKey); Block block = blocks.First(); block.Header.HashPrevBlock = context.ChainIndexer.Tip.HashBlock; return(block); }
private async Task <(TestChainContext context, IPEndPoint peerEndPoint)> InitialiseContextAndPeerEndpointAsync(Mock <IPeerAddressManager> mockPeerAddressManager = null) { string dataDir = GetTestDirectoryPath(this); TestChainContext context = await TestChainFactory.CreateAsync(KnownNetworks.RegTest, dataDir, mockPeerAddressManager); var peerEndPoint = new IPEndPoint(IPAddress.Parse("1.2.3.4"), context.Network.DefaultPort); context.PeerAddressManager.AddPeer(peerEndPoint, peerEndPoint.Address.MapToIPv6()); return(context, peerEndPoint); }