@@ -28,6 +28,51 @@ std::string string_to_hex(const std::string& input)
2828 return " 0x" + output;
2929}
3030
31+
32+ BOOST_AUTO_TEST_CASE (serialize_block2)
33+ {
34+ CBlock block = CBlock ();
35+ std::stringstream ss;
36+ ss.str (" " );
37+ block.Serialize (ss, 1 , 1 );
38+ BOOST_TEST_MESSAGE (string_to_hex (ss.str ()));
39+
40+ CTxDestination addr1 = CKeyID (uint160 (1 ));
41+ block.addressBalances [addr1] = 123 ;
42+
43+ ss.str (" " );
44+ block.Serialize (ss, 1 , 1 );
45+ BOOST_TEST_MESSAGE (string_to_hex (ss.str ()));
46+
47+ CTxDestination addr2 = CKeyID (uint160 (2 ));
48+ block.addressBalances [addr2] = 123 ;
49+
50+ ss.str (" " );
51+ block.Serialize (ss, 1 , 1 );
52+ BOOST_TEST_MESSAGE (string_to_hex (ss.str ()));
53+
54+ CTransaction tx = CTransaction ();
55+ CTxIn input = CTxIn ();
56+ input.nSequence = 678 ;
57+ CTxOut output = CTxOut ();
58+ output.nValue = 1234 ;
59+
60+ tx.vin .push_back (input);
61+ tx.vout .push_back (output);
62+
63+ block.vtx .push_back (tx);
64+
65+ ss.str (" " );
66+ block.Serialize (ss, 1 , 1 );
67+ BOOST_TEST_MESSAGE (string_to_hex (ss.str ()));
68+
69+ block.vtx .push_back (tx);
70+
71+ ss.str (" " );
72+ block.Serialize (ss, 1 , 1 );
73+ BOOST_TEST_MESSAGE (string_to_hex (ss.str ()));
74+ }
75+
3176BOOST_AUTO_TEST_CASE (serialize_block)
3277{
3378 // Test that a block can be serialized and deserialized and maintain values
@@ -154,6 +199,12 @@ BOOST_AUTO_TEST_CASE(serialize_int_map)
154199BOOST_AUTO_TEST_CASE (aaaa)
155200{
156201
202+ BOOST_TEST_MESSAGE (::GetSerializeSize (CBlock (), SER_DISK, CLIENT_VERSION));
203+ BOOST_TEST_MESSAGE (2 * GetSizeOfCompactSize (0 ));
204+ BOOST_TEST_MESSAGE (GetSizeOfCompactSize (1 ));
205+
206+
207+ /*
157208 //
158209 int64_t nStart = GetTime();
159210 CBlockIndex* pindexPrev = pindexBest;
@@ -180,7 +231,7 @@ BOOST_AUTO_TEST_CASE(aaaa)
180231 BOOST_CHECK(true);
181232
182233 //fs::remove_all(pathTemp);
183-
234+ */
184235}
185236
186237
0 commit comments