Ejemplo n.º 1
0
        //TransactionOutput、TransactionInput、CoinbaseTransaction、TransferTransactionのテスト
        public static void Test10()
        {
            Ecdsa256KeyPair keypair1 = new Ecdsa256KeyPair(true);
            Ecdsa256KeyPair keypair2 = new Ecdsa256KeyPair(true);
            Ecdsa256KeyPair keypair3 = new Ecdsa256KeyPair(true);

            Sha256Ripemd160Hash address1 = new Sha256Ripemd160Hash(keypair1.pubKey.pubKey);
            CurrencyUnit amount1 = new Creacoin(50.0m);
            Sha256Ripemd160Hash address2 = new Sha256Ripemd160Hash(keypair2.pubKey.pubKey);
            CurrencyUnit amount2 = new Creacoin(25.0m);
            Sha256Ripemd160Hash address3 = new Sha256Ripemd160Hash(keypair3.pubKey.pubKey);
            CurrencyUnit amount3 = new Yumina(0.01m);

            TransactionOutput txOut1 = new TransactionOutput();
            txOut1.LoadVersion0(address1, amount1);
            TransactionOutput txOut2 = new TransactionOutput();
            txOut2.LoadVersion0(address2, amount2);
            TransactionOutput txOut3 = new TransactionOutput();
            txOut3.LoadVersion0(address3, amount3);

            if (txOut1.Address != address1)
                throw new Exception("test10_1");
            if (txOut1.Amount != amount1)
                throw new Exception("test10_2");

            byte[] txOutBytes = txOut1.ToBinary();

            if (txOutBytes.Length != 29)
                throw new Exception("test10_3");

            TransactionOutput txOutRestore = SHAREDDATA.FromBinary<TransactionOutput>(txOutBytes, 0);

            if (!txOut1.Address.Equals(txOutRestore.Address))
                throw new Exception("test10_4");
            if (txOut1.Amount.rawAmount != txOutRestore.Amount.rawAmount)
                throw new Exception("test10_5");

            TransactionInput txIn1 = new TransactionInput();
            txIn1.LoadVersion0(0, 0, 0, keypair1.pubKey);
            TransactionInput txIn2 = new TransactionInput();
            txIn2.LoadVersion0(1, 0, 0, keypair2.pubKey);
            TransactionInput txIn3 = new TransactionInput();
            txIn3.LoadVersion0(2, 0, 0, keypair3.pubKey);

            if (txIn1.PrevTxBlockIndex != 0)
                throw new Exception("test10_6");
            if (txIn1.PrevTxIndex != 0)
                throw new Exception("test10_7");
            if (txIn1.PrevTxOutputIndex != 0)
                throw new Exception("test10_8");
            if (txIn1.SenderPubKey != keypair1.pubKey)
                throw new Exception("test10_9");

            TransactionOutput[] txOuts = new TransactionOutput[] { txOut1, txOut2, txOut3 };

            CoinbaseTransaction cTx = new CoinbaseTransaction();
            cTx.LoadVersion0(txOuts);

            if (cTx.TxOutputs != txOuts)
                throw new Exception("test10_10");
            if (cTx.TxInputs.Length != 0)
                throw new Exception("test10_11");

            byte[] cTxBytes = cTx.ToBinary();

            if (cTxBytes.Length != 97)
                throw new Exception("test10_12");

            CoinbaseTransaction cTxRestore = SHAREDDATA.FromBinary<CoinbaseTransaction>(cTxBytes);

            if (!cTx.Id.Equals(cTxRestore.Id))
                throw new Exception("test10_13");

            if (cTx.Verify())
                throw new Exception("test10_14");
            if (cTx.VerifyNotExistDustTxOutput())
                throw new Exception("test10_15");
            if (!cTx.VerifyNumberOfTxInputs())
                throw new Exception("test10_16");
            if (!cTx.VerifyNumberOfTxOutputs())
                throw new Exception("test10_17");

            TransactionOutput[] txOuts2 = new TransactionOutput[11];
            for (int i = 0; i < txOuts2.Length; i++)
                txOuts2[i] = txOut1;

            CoinbaseTransaction cTx2 = new CoinbaseTransaction();
            cTx2.LoadVersion0(txOuts2);

            if (cTx2.Verify())
                throw new Exception("test10_18");
            if (!cTx2.VerifyNotExistDustTxOutput())
                throw new Exception("test10_19");
            if (!cTx2.VerifyNumberOfTxInputs())
                throw new Exception("test10_20");
            if (cTx2.VerifyNumberOfTxOutputs())
                throw new Exception("test10_21");

            TransactionOutput[] txOuts3 = new TransactionOutput[] { txOut1, txOut2 };

            CoinbaseTransaction cTx3 = new CoinbaseTransaction();
            cTx3.LoadVersion0(txOuts3);

            if (!cTx3.Verify())
                throw new Exception("test10_22");
            if (!cTx3.VerifyNotExistDustTxOutput())
                throw new Exception("test10_23");
            if (!cTx3.VerifyNumberOfTxInputs())
                throw new Exception("test10_24");
            if (!cTx3.VerifyNumberOfTxOutputs())
                throw new Exception("test10_25");

            TransactionInput[] txIns = new TransactionInput[] { txIn1, txIn2, txIn3 };

            TransferTransaction tTx1 = new TransferTransaction();
            tTx1.LoadVersion0(txIns, txOuts);
            tTx1.Sign(txOuts, new DSAPRIVKEYBASE[] { keypair1.privKey, keypair2.privKey, keypair3.privKey });

            if (tTx1.TxInputs != txIns)
                throw new Exception("test10_26");
            if (tTx1.TxOutputs != txOuts)
                throw new Exception("test10_27");

            byte[] txInBytes = txIn1.ToBinary();

            if (txInBytes.Length != 153)
                throw new Exception("test10_28");

            TransactionInput txInRestore = SHAREDDATA.FromBinary<TransactionInput>(txInBytes, 0);

            if (txIn1.PrevTxBlockIndex != txInRestore.PrevTxBlockIndex)
                throw new Exception("test10_29");
            if (txIn1.PrevTxIndex != txInRestore.PrevTxIndex)
                throw new Exception("test10_30");
            if (txIn1.PrevTxOutputIndex != txInRestore.PrevTxOutputIndex)
                throw new Exception("test10_31");
            if (!txIn1.SenderPubKey.pubKey.BytesEquals(txInRestore.SenderPubKey.pubKey))
                throw new Exception("test10_32");
            if (!txIn1.SenderSignature.signature.BytesEquals(txInRestore.SenderSignature.signature))
                throw new Exception("test10_33");

            byte[] tTxBytes = tTx1.ToBinary();

            if (tTxBytes.Length != 557)
                throw new Exception("test10_34");

            TransferTransaction tTxRestore = SHAREDDATA.FromBinary<TransferTransaction>(tTxBytes);

            if (!tTx1.Id.Equals(tTxRestore.Id))
                throw new Exception("test10_35");

            if (tTx1.Verify(txOuts))
                throw new Exception("test10_36");
            if (tTx1.VerifyNotExistDustTxOutput())
                throw new Exception("test10_37");
            if (!tTx1.VerifyNumberOfTxInputs())
                throw new Exception("test10_38");
            if (!tTx1.VerifyNumberOfTxOutputs())
                throw new Exception("test10_39");
            if (!tTx1.VerifySignature(txOuts))
                throw new Exception("test10_40");
            if (!tTx1.VerifyPubKey(txOuts))
                throw new Exception("test10_41");
            if (!tTx1.VerifyAmount(txOuts))
                throw new Exception("test10_42");
            if (tTx1.GetFee(txOuts).rawAmount != 0)
                throw new Exception("test10_43");

            TransactionOutput[] txOuts4 = new TransactionOutput[] { txOut2, txOut1, txOut3 };

            if (tTx1.Verify(txOuts4))
                throw new Exception("test10_44");
            if (tTx1.VerifySignature(txOuts4))
                throw new Exception("test10_45");
            if (tTx1.VerifyPubKey(txOuts4))
                throw new Exception("test10_46");

            byte temp2 = tTx1.TxInputs[0].SenderSignature.signature[0];

            tTx1.TxInputs[0].SenderSignature.signature[0] = 0;

            if (tTx1.Verify(txOuts))
                throw new Exception("test10_47");
            if (tTx1.VerifySignature(txOuts))
                throw new Exception("test10_48");
            if (!tTx1.VerifyPubKey(txOuts))
                throw new Exception("test10_49");

            tTx1.TxInputs[0].SenderSignature.signature[0] = temp2;

            TransferTransaction tTx2 = new TransferTransaction();
            tTx2.LoadVersion0(txIns, txOuts);
            tTx2.Sign(txOuts, new DSAPRIVKEYBASE[] { keypair2.privKey, keypair1.privKey, keypair3.privKey });

            if (tTx2.Verify(txOuts))
                throw new Exception("test10_50");
            if (tTx2.VerifySignature(txOuts))
                throw new Exception("test10_51");
            if (!tTx2.VerifyPubKey(txOuts))
                throw new Exception("test10_52");

            TransferTransaction tTx3 = new TransferTransaction();
            tTx3.LoadVersion0(txIns, txOuts);
            tTx3.Sign(txOuts, new DSAPRIVKEYBASE[] { keypair1.privKey, keypair2.privKey, keypair3.privKey });

            byte temp = tTx3.TxInputs[0].SenderPubKey.pubKey[0];

            tTx3.TxInputs[0].SenderPubKey.pubKey[0] = 0;

            if (tTx3.Verify(txOuts))
                throw new Exception("test10_50");
            if (tTx3.VerifySignature(txOuts))
                throw new Exception("test10_51");
            if (tTx3.VerifyPubKey(txOuts))
                throw new Exception("test10_52");

            tTx3.TxInputs[0].SenderPubKey.pubKey[0] = temp;

            TransferTransaction tTx4 = new TransferTransaction();
            tTx4.LoadVersion0(txIns, txOuts2);
            tTx4.Sign(txOuts, new DSAPRIVKEYBASE[] { keypair1.privKey, keypair2.privKey, keypair3.privKey });

            if (tTx4.Verify(txOuts))
                throw new Exception("test10_53");
            if (!tTx4.VerifyNotExistDustTxOutput())
                throw new Exception("test10_54");
            if (!tTx4.VerifyNumberOfTxInputs())
                throw new Exception("test10_55");
            if (tTx4.VerifyNumberOfTxOutputs())
                throw new Exception("test10_56");
            if (!tTx4.VerifySignature(txOuts))
                throw new Exception("test10_57");
            if (!tTx4.VerifyPubKey(txOuts))
                throw new Exception("test10_58");
            if (tTx4.VerifyAmount(txOuts))
                throw new Exception("test10_59");
            if (tTx4.GetFee(txOuts).rawAmount != -47499990000)
                throw new Exception("test10_60");

            TransferTransaction tTx5 = new TransferTransaction();
            tTx5.LoadVersion0(txIns, txOuts3);
            tTx5.Sign(txOuts, new DSAPRIVKEYBASE[] { keypair1.privKey, keypair2.privKey, keypair3.privKey });

            if (!tTx5.Verify(txOuts))
                throw new Exception("test10_61");
            if (!tTx5.VerifyNotExistDustTxOutput())
                throw new Exception("test10_62");
            if (!tTx5.VerifyNumberOfTxInputs())
                throw new Exception("test10_63");
            if (!tTx5.VerifyNumberOfTxOutputs())
                throw new Exception("test10_64");
            if (!tTx5.VerifySignature(txOuts))
                throw new Exception("test10_65");
            if (!tTx5.VerifyPubKey(txOuts))
                throw new Exception("test10_66");
            if (!tTx5.VerifyAmount(txOuts))
                throw new Exception("test10_67");
            if (tTx5.GetFee(txOuts).rawAmount != 10000)
                throw new Exception("test10_68");

            TransactionInput[] txIns2 = new TransactionInput[101];
            for (int i = 0; i < txIns2.Length; i++)
                txIns2[i] = txIn1;

            TransactionOutput[] txOuts5 = new TransactionOutput[txIns2.Length];
            for (int i = 0; i < txOuts5.Length; i++)
                txOuts5[i] = txOut1;

            Ecdsa256PrivKey[] privKeys = new Ecdsa256PrivKey[txIns2.Length];
            for (int i = 0; i < privKeys.Length; i++)
                privKeys[i] = keypair1.privKey;

            TransferTransaction tTx6 = new TransferTransaction();
            tTx6.LoadVersion0(txIns2, txOuts3);
            tTx6.Sign(txOuts5, privKeys);

            if (tTx6.Verify(txOuts5))
                throw new Exception("test10_61");
            if (!tTx6.VerifyNotExistDustTxOutput())
                throw new Exception("test10_62");
            if (tTx6.VerifyNumberOfTxInputs())
                throw new Exception("test10_63");
            if (!tTx6.VerifyNumberOfTxOutputs())
                throw new Exception("test10_64");
            if (!tTx6.VerifySignature(txOuts5))
                throw new Exception("test10_65");
            if (!tTx6.VerifyPubKey(txOuts5))
                throw new Exception("test10_66");
            if (!tTx6.VerifyAmount(txOuts5))
                throw new Exception("test10_67");
            if (tTx6.GetFee(txOuts5).rawAmount != 497500000000)
                throw new Exception("test10_68");

            byte[] cTxBytes2 = SHAREDDATA.ToBinary<Transaction>(cTx);

            if (cTxBytes2.Length != 117)
                throw new Exception("test10_69");

            CoinbaseTransaction cTxRestore2 = SHAREDDATA.FromBinary<Transaction>(cTxBytes2) as CoinbaseTransaction;

            if (!cTx.Id.Equals(cTxRestore2.Id))
                throw new Exception("test10_70");

            byte[] tTxBytes2 = SHAREDDATA.ToBinary<Transaction>(tTx6);

            if (tTxBytes2.Length != 15445)
                throw new Exception("test10_71");

            TransferTransaction tTxRestore2 = SHAREDDATA.FromBinary<Transaction>(tTxBytes2) as TransferTransaction;

            if (!tTx6.Id.Equals(tTxRestore2.Id))
                throw new Exception("test10_72");

            Sha256Sha256Hash ctxid = new Sha256Sha256Hash(cTxBytes);

            if (!ctxid.Equals(cTx.Id))
                throw new Exception("test10_73");

            Sha256Sha256Hash ttxid = new Sha256Sha256Hash(tTx6.ToBinary());

            if (!ttxid.Equals(tTx6.Id))
                throw new Exception("test10_74");

            Console.WriteLine("test10_succeeded");
        }
Ejemplo n.º 2
0
        //Blockのテスト1
        public static void Test11()
        {
            GenesisBlock gblk = new GenesisBlock();

            if (gblk.Index != 0)
                throw new Exception("test11_1");
            if (gblk.PrevId != null)
                throw new Exception("test11_2");
            if (gblk.Difficulty.Diff != 0.00000011)
                throw new Exception("test11_3");
            if (gblk.Transactions.Length != 0)
                throw new Exception("test11_4");

            byte[] gblkBytes = gblk.ToBinary();

            if (gblkBytes.Length != 68)
                throw new Exception("test11_5");

            GenesisBlock gblkRestore = SHAREDDATA.FromBinary<GenesisBlock>(gblkBytes);

            if (!gblk.Id.Equals(gblkRestore.Id))
                throw new Exception("test11_6");

            byte[] gblkBytes2 = SHAREDDATA.ToBinary<Block>(gblk);

            if (gblkBytes2.Length != 88)
                throw new Exception("test11_7");

            GenesisBlock gblkRestore2 = SHAREDDATA.FromBinary<Block>(gblkBytes2) as GenesisBlock;

            if (!gblk.Id.Equals(gblkRestore2.Id))
                throw new Exception("test11_8");

            BlockHeader bh = new BlockHeader();

            bool flag = false;
            try
            {
                bh.LoadVersion0(0, null, DateTime.Now, null, new byte[10]);
            }
            catch (ArgumentOutOfRangeException)
            {
                flag = true;
            }
            if (!flag)
                throw new Exception("test11_9");

            bool flag2 = false;
            try
            {
                bh.LoadVersion0(1, null, DateTime.Now, null, new byte[9]);
            }
            catch (ArgumentOutOfRangeException)
            {
                flag2 = true;
            }
            if (!flag2)
                throw new Exception("test11_10");

            Difficulty<Creahash> diff = new Difficulty<Creahash>(HASHBASE.FromHash<Creahash>(new byte[] { 0, 127, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }));
            Sha256Sha256Hash hash = new Sha256Sha256Hash(new byte[] { 1 });
            DateTime dt = DateTime.Now;
            byte[] nonce = new byte[10] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            bh.LoadVersion0(1, gblk.Id, DateTime.Now, diff, new byte[10]);

            bool flag3 = false;
            try
            {
                bh.UpdateNonce(new byte[11]);
            }
            catch (ArgumentOutOfRangeException)
            {
                flag3 = true;
            }
            if (!flag3)
                throw new Exception("test11_11");

            bh.UpdateMerkleRootHash(hash);
            bh.UpdateTimestamp(dt);
            bh.UpdateNonce(nonce);

            if (bh.index != 1)
                throw new Exception("test11_12");
            if (bh.prevBlockHash != gblk.Id)
                throw new Exception("test11_13");
            if (bh.merkleRootHash != hash)
                throw new Exception("test11_14");
            if (bh.timestamp != dt)
                throw new Exception("test11_15");
            if (bh.difficulty != diff)
                throw new Exception("test11_16");
            if (bh.nonce != nonce)
                throw new Exception("test11_17");

            byte[] bhBytes = bh.ToBinary();

            if (bhBytes.Length != 95)
                throw new Exception("test11_18");

            BlockHeader bhRestore = SHAREDDATA.FromBinary<BlockHeader>(bhBytes);

            if (bh.index != bhRestore.index)
                throw new Exception("test11_19");
            if (!bh.prevBlockHash.Equals(bhRestore.prevBlockHash))
                throw new Exception("test11_20");
            if (!bh.merkleRootHash.Equals(bhRestore.merkleRootHash))
                throw new Exception("test11_21");
            if (bh.timestamp != bhRestore.timestamp)
                throw new Exception("test11_22");
            if (bh.difficulty.Diff != bhRestore.difficulty.Diff)
                throw new Exception("test11_23");
            if (!bh.nonce.BytesEquals(bhRestore.nonce))
                throw new Exception("test11_24");

            bool flag4 = false;
            try
            {
                TransactionalBlock.GetBlockType(0, 0);
            }
            catch (ArgumentOutOfRangeException)
            {
                flag4 = true;
            }
            if (!flag4)
                throw new Exception("test11_25");

            Type type1 = TransactionalBlock.GetBlockType(60 * 24 - 1, 0);
            Type type2 = TransactionalBlock.GetBlockType(60 * 24, 0);
            Type type3 = TransactionalBlock.GetBlockType(60 * 24 + 1, 0);

            if (type1 != typeof(NormalBlock))
                throw new Exception("test11_26");
            if (type2 != typeof(FoundationalBlock))
                throw new Exception("test11_27");
            if (type3 != typeof(NormalBlock))
                throw new Exception("test11_28");

            bool flag5 = false;
            try
            {
                TransactionalBlock.GetRewardToAll(0, 0);
            }
            catch (ArgumentOutOfRangeException)
            {
                flag5 = true;
            }
            if (!flag5)
                throw new Exception("test11_29");

            bool flag6 = false;
            try
            {
                TransactionalBlock.GetRewardToMiner(0, 0);
            }
            catch (ArgumentOutOfRangeException)
            {
                flag6 = true;
            }
            if (!flag6)
                throw new Exception("test11_30");

            bool flag7 = false;
            try
            {
                TransactionalBlock.GetRewardToFoundation(0, 0);
            }
            catch (ArgumentOutOfRangeException)
            {
                flag7 = true;
            }
            if (!flag7)
                throw new Exception("test11_31");

            bool flag8 = false;
            try
            {
                TransactionalBlock.GetRewardToFoundationInterval(0, 0);
            }
            catch (ArgumentOutOfRangeException)
            {
                flag8 = true;
            }
            if (!flag8)
                throw new Exception("test11_32");

            bool flag9 = false;
            try
            {
                TransactionalBlock.GetRewardToFoundationInterval(1, 0);
            }
            catch (ArgumentException)
            {
                flag9 = true;
            }
            if (!flag9)
                throw new Exception("test11_33");

            CurrencyUnit initial = new Creacoin(60.0m);
            decimal rate = 1.25m;
            for (int i = 0; i < 8; i++)
            {
                CurrencyUnit reward1 = i != 0 ? TransactionalBlock.GetRewardToAll((60 * 24 * 365 * i) - 1, 0) : null;
                CurrencyUnit reward2 = i != 0 ? TransactionalBlock.GetRewardToAll(60 * 24 * 365 * i, 0) : null;
                CurrencyUnit reward3 = TransactionalBlock.GetRewardToAll((60 * 24 * 365 * i) + 1, 0);

                CurrencyUnit reward7 = i != 0 ? TransactionalBlock.GetRewardToMiner((60 * 24 * 365 * i) - 1, 0) : null;
                CurrencyUnit reward8 = i != 0 ? TransactionalBlock.GetRewardToMiner(60 * 24 * 365 * i, 0) : null;
                CurrencyUnit reward9 = TransactionalBlock.GetRewardToMiner((60 * 24 * 365 * i) + 1, 0);

                CurrencyUnit reward10 = i != 0 ? TransactionalBlock.GetRewardToFoundation((60 * 24 * 365 * i) - 1, 0) : null;
                CurrencyUnit reward11 = i != 0 ? TransactionalBlock.GetRewardToFoundation(60 * 24 * 365 * i, 0) : null;
                CurrencyUnit reward12 = TransactionalBlock.GetRewardToFoundation((60 * 24 * 365 * i) + 1, 0);

                CurrencyUnit reward19 = i != 0 ? TransactionalBlock.GetRewardToFoundationInterval(((365 * i) - 1) * 60 * 24, 0) : null;
                CurrencyUnit reward20 = i != 0 ? TransactionalBlock.GetRewardToFoundationInterval(60 * 24 * 365 * i, 0) : null;
                CurrencyUnit reward21 = TransactionalBlock.GetRewardToFoundationInterval(((365 * i) + 1) * 60 * 24, 0);

                if (i != 0 && reward1.rawAmount != initial.rawAmount * rate)
                    throw new Exception("test11_34");
                if (i != 0 && reward7.rawAmount != initial.rawAmount * rate * 0.9m)
                    throw new Exception("test11_35");
                if (i != 0 && reward10.rawAmount != initial.rawAmount * rate * 0.1m)
                    throw new Exception("test11_36");
                if (i != 0 && reward19.rawAmount != initial.rawAmount * rate * 0.1m * 60m * 24m)
                    throw new Exception("test11_37");

                rate *= 0.8m;

                if (i != 0 && reward2.rawAmount != initial.rawAmount * rate)
                    throw new Exception("test11_38");
                if (i != 0 && reward8.rawAmount != initial.rawAmount * rate * 0.9m)
                    throw new Exception("test11_39");
                if (i != 0 && reward11.rawAmount != initial.rawAmount * rate * 0.1m)
                    throw new Exception("test11_40");
                if (i != 0 && reward20.rawAmount != initial.rawAmount * rate * 0.1m * 60m * 24m)
                    throw new Exception("test11_41");

                if (reward3.rawAmount != initial.rawAmount * rate)
                    throw new Exception("test11_42");
                if (reward9.rawAmount != initial.rawAmount * rate * 0.9m)
                    throw new Exception("test11_43");
                if (reward12.rawAmount != initial.rawAmount * rate * 0.1m)
                    throw new Exception("test11_44");
                if (reward21.rawAmount != initial.rawAmount * rate * 0.1m * 60m * 24m)
                    throw new Exception("test11_45");
            }

            CurrencyUnit reward4 = TransactionalBlock.GetRewardToAll((60 * 24 * 365 * 8) - 1, 0);
            CurrencyUnit reward5 = TransactionalBlock.GetRewardToAll(60 * 24 * 365 * 8, 0);
            CurrencyUnit reward6 = TransactionalBlock.GetRewardToAll((60 * 24 * 365 * 8) + 1, 0);

            CurrencyUnit reward13 = TransactionalBlock.GetRewardToMiner((60 * 24 * 365 * 8) - 1, 0);
            CurrencyUnit reward14 = TransactionalBlock.GetRewardToMiner(60 * 24 * 365 * 8, 0);
            CurrencyUnit reward15 = TransactionalBlock.GetRewardToMiner((60 * 24 * 365 * 8) + 1, 0);

            CurrencyUnit reward16 = TransactionalBlock.GetRewardToFoundation((60 * 24 * 365 * 8) - 1, 0);
            CurrencyUnit reward17 = TransactionalBlock.GetRewardToFoundation(60 * 24 * 365 * 8, 0);
            CurrencyUnit reward18 = TransactionalBlock.GetRewardToFoundation((60 * 24 * 365 * 8) + 1, 0);

            CurrencyUnit reward22 = TransactionalBlock.GetRewardToFoundationInterval(((365 * 8) - 1) * 60 * 24, 0);
            CurrencyUnit reward23 = TransactionalBlock.GetRewardToFoundationInterval(60 * 24 * 365 * 8, 0);
            CurrencyUnit reward24 = TransactionalBlock.GetRewardToFoundationInterval(((365 * 8) + 1) * 60 * 24, 0);

            if (reward4.rawAmount != initial.rawAmount * rate)
                throw new Exception("test11_46");
            if (reward13.rawAmount != initial.rawAmount * rate * 0.9m)
                throw new Exception("test11_47");
            if (reward16.rawAmount != initial.rawAmount * rate * 0.1m)
                throw new Exception("test11_48");
            if (reward22.rawAmount != initial.rawAmount * rate * 0.1m * 60m * 24m)
                throw new Exception("test11_49");

            if (reward5.rawAmount != 0)
                throw new Exception("test11_50");
            if (reward14.rawAmount != 0)
                throw new Exception("test11_51");
            if (reward17.rawAmount != 0)
                throw new Exception("test11_52");
            if (reward23.rawAmount != 0)
                throw new Exception("test11_53");

            if (reward6.rawAmount != 0)
                throw new Exception("test11_54");
            if (reward15.rawAmount != 0)
                throw new Exception("test11_55");
            if (reward18.rawAmount != 0)
                throw new Exception("test11_56");
            if (reward24.rawAmount != 0)
                throw new Exception("test11_57");

            Console.WriteLine("test11_succeeded");
        }