@@ -36,42 +36,42 @@ BOOST_AUTO_TEST_CASE(bloom_create_insert_serialize)
36
36
{
37
37
CBloomFilter filter (3 , 0.01 , 0 , BLOOM_UPDATE_ALL);
38
38
39
- BOOST_CHECK_MESSAGE ( !filter.contains (ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8" ) ), " Bloom filter should be empty!" );
40
- filter.insert (ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8" ) );
41
- BOOST_CHECK_MESSAGE ( filter.contains (ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8" ) ), " Bloom filter doesn't contain just-inserted object!" );
39
+ BOOST_CHECK_MESSAGE ( !filter.contains (" 99108ad8ed9bb6274d3980bab5a85c048f0950c8" _hex_u8 ), " Bloom filter should be empty!" );
40
+ filter.insert (" 99108ad8ed9bb6274d3980bab5a85c048f0950c8" _hex_u8 );
41
+ BOOST_CHECK_MESSAGE ( filter.contains (" 99108ad8ed9bb6274d3980bab5a85c048f0950c8" _hex_u8 ), " Bloom filter doesn't contain just-inserted object!" );
42
42
// One bit different in first byte
43
- BOOST_CHECK_MESSAGE (!filter.contains (ParseHex ( " 19108ad8ed9bb6274d3980bab5a85c048f0950c8" ) ), " Bloom filter contains something it shouldn't!" );
43
+ BOOST_CHECK_MESSAGE (!filter.contains (" 19108ad8ed9bb6274d3980bab5a85c048f0950c8" _hex_u8 ), " Bloom filter contains something it shouldn't!" );
44
44
45
- filter.insert (ParseHex ( " b5a2c786d9ef4658287ced5914b37a1b4aa32eee" ) );
46
- BOOST_CHECK_MESSAGE (filter.contains (ParseHex ( " b5a2c786d9ef4658287ced5914b37a1b4aa32eee" ) ), " Bloom filter doesn't contain just-inserted object (2)!" );
45
+ filter.insert (" b5a2c786d9ef4658287ced5914b37a1b4aa32eee" _hex_u8 );
46
+ BOOST_CHECK_MESSAGE (filter.contains (" b5a2c786d9ef4658287ced5914b37a1b4aa32eee" _hex_u8 ), " Bloom filter doesn't contain just-inserted object (2)!" );
47
47
48
- filter.insert (ParseHex ( " b9300670b4c5366e95b2699e8b18bc75e5f729c5" ) );
49
- BOOST_CHECK_MESSAGE (filter.contains (ParseHex ( " b9300670b4c5366e95b2699e8b18bc75e5f729c5" ) ), " Bloom filter doesn't contain just-inserted object (3)!" );
48
+ filter.insert (" b9300670b4c5366e95b2699e8b18bc75e5f729c5" _hex_u8 );
49
+ BOOST_CHECK_MESSAGE (filter.contains (" b9300670b4c5366e95b2699e8b18bc75e5f729c5" _hex_u8 ), " Bloom filter doesn't contain just-inserted object (3)!" );
50
50
51
51
DataStream stream{};
52
52
stream << filter;
53
53
54
54
constexpr auto expected{" 03614e9b050000000000000001" _hex};
55
55
BOOST_CHECK_EQUAL_COLLECTIONS (stream.begin (), stream.end (), expected.begin (), expected.end ());
56
56
57
- BOOST_CHECK_MESSAGE ( filter.contains (ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8" ) ), " Bloom filter doesn't contain just-inserted object!" );
57
+ BOOST_CHECK_MESSAGE ( filter.contains (" 99108ad8ed9bb6274d3980bab5a85c048f0950c8" _hex_u8 ), " Bloom filter doesn't contain just-inserted object!" );
58
58
}
59
59
60
60
BOOST_AUTO_TEST_CASE (bloom_create_insert_serialize_with_tweak)
61
61
{
62
62
// Same test as bloom_create_insert_serialize, but we add a nTweak of 100
63
63
CBloomFilter filter (3 , 0.01 , 2147483649UL , BLOOM_UPDATE_ALL);
64
64
65
- filter.insert (ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8" ) );
66
- BOOST_CHECK_MESSAGE ( filter.contains (ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8" ) ), " Bloom filter doesn't contain just-inserted object!" );
65
+ filter.insert (" 99108ad8ed9bb6274d3980bab5a85c048f0950c8" _hex_u8 );
66
+ BOOST_CHECK_MESSAGE ( filter.contains (" 99108ad8ed9bb6274d3980bab5a85c048f0950c8" _hex_u8 ), " Bloom filter doesn't contain just-inserted object!" );
67
67
// One bit different in first byte
68
- BOOST_CHECK_MESSAGE (!filter.contains (ParseHex ( " 19108ad8ed9bb6274d3980bab5a85c048f0950c8" ) ), " Bloom filter contains something it shouldn't!" );
68
+ BOOST_CHECK_MESSAGE (!filter.contains (" 19108ad8ed9bb6274d3980bab5a85c048f0950c8" _hex_u8 ), " Bloom filter contains something it shouldn't!" );
69
69
70
- filter.insert (ParseHex ( " b5a2c786d9ef4658287ced5914b37a1b4aa32eee" ) );
71
- BOOST_CHECK_MESSAGE (filter.contains (ParseHex ( " b5a2c786d9ef4658287ced5914b37a1b4aa32eee" ) ), " Bloom filter doesn't contain just-inserted object (2)!" );
70
+ filter.insert (" b5a2c786d9ef4658287ced5914b37a1b4aa32eee" _hex_u8 );
71
+ BOOST_CHECK_MESSAGE (filter.contains (" b5a2c786d9ef4658287ced5914b37a1b4aa32eee" _hex_u8 ), " Bloom filter doesn't contain just-inserted object (2)!" );
72
72
73
- filter.insert (ParseHex ( " b9300670b4c5366e95b2699e8b18bc75e5f729c5" ) );
74
- BOOST_CHECK_MESSAGE (filter.contains (ParseHex ( " b9300670b4c5366e95b2699e8b18bc75e5f729c5" ) ), " Bloom filter doesn't contain just-inserted object (3)!" );
73
+ filter.insert (" b9300670b4c5366e95b2699e8b18bc75e5f729c5" _hex_u8 );
74
+ BOOST_CHECK_MESSAGE (filter.contains (" b9300670b4c5366e95b2699e8b18bc75e5f729c5" _hex_u8 ), " Bloom filter doesn't contain just-inserted object (3)!" );
75
75
76
76
DataStream stream{};
77
77
stream << filter;
@@ -119,24 +119,24 @@ BOOST_AUTO_TEST_CASE(bloom_match)
119
119
120
120
filter = CBloomFilter (10 , 0.000001 , 0 , BLOOM_UPDATE_ALL);
121
121
// byte-reversed tx hash
122
- filter.insert (ParseHex ( " 6bff7fcd4f8565ef406dd5d63d4ff94f318fe82027fd4dc451b04474019f74b4" ) );
122
+ filter.insert (" 6bff7fcd4f8565ef406dd5d63d4ff94f318fe82027fd4dc451b04474019f74b4" _hex_u8 );
123
123
BOOST_CHECK_MESSAGE (filter.IsRelevantAndUpdate (tx), " Simple Bloom filter didn't match manually serialized tx hash" );
124
124
125
125
filter = CBloomFilter (10 , 0.000001 , 0 , BLOOM_UPDATE_ALL);
126
- filter.insert (ParseHex ( " 30450220070aca44506c5cef3a16ed519d7c3c39f8aab192c4e1c90d065f37b8a4af6141022100a8e160b856c2d43d27d8fba71e5aef6405b8643ac4cb7cb3c462aced7f14711a01" ) );
126
+ filter.insert (" 30450220070aca44506c5cef3a16ed519d7c3c39f8aab192c4e1c90d065f37b8a4af6141022100a8e160b856c2d43d27d8fba71e5aef6405b8643ac4cb7cb3c462aced7f14711a01" _hex_u8 );
127
127
BOOST_CHECK_MESSAGE (filter.IsRelevantAndUpdate (tx), " Simple Bloom filter didn't match input signature" );
128
128
129
129
filter = CBloomFilter (10 , 0.000001 , 0 , BLOOM_UPDATE_ALL);
130
- filter.insert (ParseHex ( " 046d11fee51b0e60666d5049a9101a72741df480b96ee26488a4d3466b95c9a40ac5eeef87e10a5cd336c19a84565f80fa6c547957b7700ff4dfbdefe76036c339" ) );
130
+ filter.insert (" 046d11fee51b0e60666d5049a9101a72741df480b96ee26488a4d3466b95c9a40ac5eeef87e10a5cd336c19a84565f80fa6c547957b7700ff4dfbdefe76036c339" _hex_u8 );
131
131
BOOST_CHECK_MESSAGE (filter.IsRelevantAndUpdate (tx), " Simple Bloom filter didn't match input pub key" );
132
132
133
133
filter = CBloomFilter (10 , 0.000001 , 0 , BLOOM_UPDATE_ALL);
134
- filter.insert (ParseHex ( " 04943fdd508053c75000106d3bc6e2754dbcff19" ) );
134
+ filter.insert (" 04943fdd508053c75000106d3bc6e2754dbcff19" _hex_u8 );
135
135
BOOST_CHECK_MESSAGE (filter.IsRelevantAndUpdate (tx), " Simple Bloom filter didn't match output address" );
136
136
BOOST_CHECK_MESSAGE (filter.IsRelevantAndUpdate (spendingTx), " Simple Bloom filter didn't add output" );
137
137
138
138
filter = CBloomFilter (10 , 0.000001 , 0 , BLOOM_UPDATE_ALL);
139
- filter.insert (ParseHex ( " a266436d2965547608b9e15d9032a7b9d64fa431" ) );
139
+ filter.insert (" a266436d2965547608b9e15d9032a7b9d64fa431" _hex_u8 );
140
140
BOOST_CHECK_MESSAGE (filter.IsRelevantAndUpdate (tx), " Simple Bloom filter didn't match output address" );
141
141
142
142
filter = CBloomFilter (10 , 0.000001 , 0 , BLOOM_UPDATE_ALL);
@@ -158,7 +158,7 @@ BOOST_AUTO_TEST_CASE(bloom_match)
158
158
BOOST_CHECK_MESSAGE (!filter.IsRelevantAndUpdate (tx), " Simple Bloom filter matched random tx hash" );
159
159
160
160
filter = CBloomFilter (10 , 0.000001 , 0 , BLOOM_UPDATE_ALL);
161
- filter.insert (ParseHex ( " 0000006d2965547608b9e15d9032a7b9d64fa431" ) );
161
+ filter.insert (" 0000006d2965547608b9e15d9032a7b9d64fa431" _hex_u8 );
162
162
BOOST_CHECK_MESSAGE (!filter.IsRelevantAndUpdate (tx), " Simple Bloom filter matched random address" );
163
163
164
164
filter = CBloomFilter (10 , 0.000001 , 0 , BLOOM_UPDATE_ALL);
@@ -244,7 +244,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_2)
244
244
// Match an output from the second transaction (the pubkey for address 1DZTzaBHUDM7T3QvUKBz4qXMRpkg8jsfB5)
245
245
// This should match the third transaction because it spends the output matched
246
246
// It also matches the fourth transaction, which spends to the pubkey again
247
- filter.insert (ParseHex ( " 044a656f065871a353f216ca26cef8dde2f03e8c16202d2e8ad769f02032cb86a5eb5e56842e92e19141d60a01928f8dd2c875a390f67c1f6c94cfc617c0ea45af" ) );
247
+ filter.insert (" 044a656f065871a353f216ca26cef8dde2f03e8c16202d2e8ad769f02032cb86a5eb5e56842e92e19141d60a01928f8dd2c875a390f67c1f6c94cfc617c0ea45af" _hex_u8 );
248
248
249
249
merkleBlock = CMerkleBlock (block, filter);
250
250
BOOST_CHECK (merkleBlock.header .GetHash () == block.GetHash ());
@@ -301,7 +301,7 @@ BOOST_AUTO_TEST_CASE(merkle_block_2_with_update_none)
301
301
// Match an output from the second transaction (the pubkey for address 1DZTzaBHUDM7T3QvUKBz4qXMRpkg8jsfB5)
302
302
// This should not match the third transaction though it spends the output matched
303
303
// It will match the fourth transaction, which has another pay-to-pubkey output to the same address
304
- filter.insert (ParseHex ( " 044a656f065871a353f216ca26cef8dde2f03e8c16202d2e8ad769f02032cb86a5eb5e56842e92e19141d60a01928f8dd2c875a390f67c1f6c94cfc617c0ea45af" ) );
304
+ filter.insert (" 044a656f065871a353f216ca26cef8dde2f03e8c16202d2e8ad769f02032cb86a5eb5e56842e92e19141d60a01928f8dd2c875a390f67c1f6c94cfc617c0ea45af" _hex_u8 );
305
305
306
306
merkleBlock = CMerkleBlock (block, filter);
307
307
BOOST_CHECK (merkleBlock.header .GetHash () == block.GetHash ());
@@ -418,9 +418,9 @@ BOOST_AUTO_TEST_CASE(merkle_block_4_test_p2pubkey_only)
418
418
419
419
CBloomFilter filter (10 , 0.000001 , 0 , BLOOM_UPDATE_P2PUBKEY_ONLY);
420
420
// Match the generation pubkey
421
- filter.insert (ParseHex ( " 04eaafc2314def4ca98ac970241bcab022b9c1e1f4ea423a20f134c876f2c01ec0f0dd5b2e86e7168cefe0d81113c3807420ce13ad1357231a2252247d97a46a91" ) );
421
+ filter.insert (" 04eaafc2314def4ca98ac970241bcab022b9c1e1f4ea423a20f134c876f2c01ec0f0dd5b2e86e7168cefe0d81113c3807420ce13ad1357231a2252247d97a46a91" _hex_u8 );
422
422
// ...and the output address of the 4th transaction
423
- filter.insert (ParseHex ( " b6efd80d99179f4f4ff6f4dd0a007d018c385d21" ) );
423
+ filter.insert (" b6efd80d99179f4f4ff6f4dd0a007d018c385d21" _hex_u8 );
424
424
425
425
CMerkleBlock merkleBlock (block, filter);
426
426
BOOST_CHECK (merkleBlock.header .GetHash () == block.GetHash ());
@@ -443,9 +443,9 @@ BOOST_AUTO_TEST_CASE(merkle_block_4_test_update_none)
443
443
444
444
CBloomFilter filter (10 , 0.000001 , 0 , BLOOM_UPDATE_NONE);
445
445
// Match the generation pubkey
446
- filter.insert (ParseHex ( " 04eaafc2314def4ca98ac970241bcab022b9c1e1f4ea423a20f134c876f2c01ec0f0dd5b2e86e7168cefe0d81113c3807420ce13ad1357231a2252247d97a46a91" ) );
446
+ filter.insert (" 04eaafc2314def4ca98ac970241bcab022b9c1e1f4ea423a20f134c876f2c01ec0f0dd5b2e86e7168cefe0d81113c3807420ce13ad1357231a2252247d97a46a91" _hex_u8 );
447
447
// ...and the output address of the 4th transaction
448
- filter.insert (ParseHex ( " b6efd80d99179f4f4ff6f4dd0a007d018c385d21" ) );
448
+ filter.insert (" b6efd80d99179f4f4ff6f4dd0a007d018c385d21" _hex_u8 );
449
449
450
450
CMerkleBlock merkleBlock (block, filter);
451
451
BOOST_CHECK (merkleBlock.header .GetHash () == block.GetHash ());
0 commit comments