private IEnumerable<Block> GetBlocksForDuplicateTransactionHashScenario(ByteArray duplicateTransactionHash) { DataHelper dataHelper = new DataHelper(); Block block1 = dataHelper.GenerateBlock( blockHash: SampleByteArray.GetSampleByteArray(1), transactionHash: SampleByteArray.GetSampleByteArray(1), input: new InputInfo(ByteArray.Empty, TransactionInput.OutputIndexNotUsed), output: new OutputInfo(10)); Block block2 = dataHelper.GenerateBlock( blockHash: SampleByteArray.GetSampleByteArray(2), transactionHash: SampleByteArray.GetSampleByteArray(2), input: new InputInfo(ByteArray.Empty, TransactionInput.OutputIndexNotUsed), output: new OutputInfo(10)); // The block that contains the first instance of a duplicate transaction hash. Block block3 = dataHelper.GenerateBlock( blockHash: SampleByteArray.GetSampleByteArray(3), transactionHash: duplicateTransactionHash, inputs: new InputInfo[] { new InputInfo(block1.Transactions[0].TransactionHash, 0) }, outputs: new OutputInfo[] { new OutputInfo(3), new OutputInfo(7) }); // This block spends the first output of the first transaction that has the duplicate hash. Block block4 = dataHelper.GenerateBlock( blockHash: SampleByteArray.GetSampleByteArray(4), transactionHash: SampleByteArray.GetSampleByteArray(4), input: new InputInfo(duplicateTransactionHash, 0), output: new OutputInfo(3)); // The block that contains the second instance of a duplicate transaction hash. // Technically this makes the unspent outputs of the first transaction that has the same hash unspendable. Block block5 = dataHelper.GenerateBlock( blockHash: SampleByteArray.GetSampleByteArray(5), transactionHash: duplicateTransactionHash, inputs: new InputInfo[] { new InputInfo(block2.Transactions[0].TransactionHash, 0) }, outputs: new OutputInfo[] { new OutputInfo(4), new OutputInfo(6) }); // This block spends the second output of the second transaction that has the duplicate hash. Block block6 = dataHelper.GenerateBlock( blockHash: SampleByteArray.GetSampleByteArray(6), transactionHash: SampleByteArray.GetSampleByteArray(6), input: new InputInfo(duplicateTransactionHash, 1), output: new OutputInfo(6)); Block block7 = dataHelper.GenerateBlock( blockHash: SampleByteArray.GetSampleByteArray(7), transactionHash: SampleByteArray.GetSampleByteArray(7), input: new InputInfo(ByteArray.Empty, TransactionInput.OutputIndexNotUsed), output: new OutputInfo(10)); // The block that contains the third instance of a duplicate transaction hash. // Technically this makes the unspent outputs of the first two transaction that have the same hash unspendable. Block block8 = dataHelper.GenerateBlock( blockHash: SampleByteArray.GetSampleByteArray(8), transactionHash: duplicateTransactionHash, inputs: new InputInfo[] { new InputInfo(block7.Transactions[0].TransactionHash, 0) }, outputs: new OutputInfo[] { new OutputInfo(2), new OutputInfo(8) }); return new List<Block>() { block1, block2, block3, block4, block5, block6, block7, block8, }; }
private IEnumerable<Block> GetBlocksForSimpleScenario() { DataHelper dataHelper = new DataHelper(); Block block1 = dataHelper.GenerateBlock( blockHash: SampleByteArray.GetSampleByteArray(1), transactionHash: SampleByteArray.GetSampleByteArray(1), input: new InputInfo(ByteArray.Empty, TransactionInput.OutputIndexNotUsed), output: new OutputInfo(50)); Block block2 = dataHelper.GenerateBlock( blockHash: SampleByteArray.GetSampleByteArray(2), transactionHash: SampleByteArray.GetSampleByteArray(2), input: new InputInfo(block1.Transactions[0].TransactionHash, 0), output: new OutputInfo(49)); return new List<Block>() { block1, block2, }; }