@@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
163
163
removed.clear ();
164
164
}
165
165
166
- BOOST_AUTO_TEST_CASE (MempoolIndexByBareTxid )
166
+ BOOST_AUTO_TEST_CASE (MempoolDirectLookup )
167
167
{
168
168
CTransaction tx;
169
169
std::list<CTransaction> removed;
@@ -172,14 +172,62 @@ BOOST_AUTO_TEST_CASE(MempoolIndexByBareTxid)
172
172
173
173
BOOST_CHECK (testPool.lookupBareTxid (txParent.GetBareTxid (), tx));
174
174
BOOST_CHECK (tx.GetHash () == txParent.GetHash ());
175
+ BOOST_CHECK (testPool.lookup (txParent.GetHash (), tx));
176
+ BOOST_CHECK (tx.GetHash () == txParent.GetHash ());
177
+
178
+ BOOST_CHECK (!testPool.lookup (txParent.GetBareTxid (), tx));
175
179
BOOST_CHECK (!testPool.lookupBareTxid (txParent.GetHash (), tx));
176
180
177
181
testPool.remove (txParent, removed, true );
182
+ BOOST_CHECK (!testPool.lookup (txParent.GetHash (), tx));
183
+ BOOST_CHECK (!testPool.lookup (txChild[0 ].GetHash (), tx));
184
+ BOOST_CHECK (!testPool.lookup (txGrandChild[0 ].GetHash (), tx));
178
185
BOOST_CHECK (!testPool.lookupBareTxid (txParent.GetBareTxid (), tx));
179
186
BOOST_CHECK (!testPool.lookupBareTxid (txChild[0 ].GetBareTxid (), tx));
180
187
BOOST_CHECK (!testPool.lookupBareTxid (txGrandChild[0 ].GetBareTxid (), tx));
181
188
}
182
189
190
+ BOOST_AUTO_TEST_CASE (MempoolOutpointLookup)
191
+ {
192
+ CTransaction tx;
193
+ CCoins c;
194
+
195
+ AddAll ();
196
+ CCoinsViewMemPool viewPool (&coins, testPool);
197
+
198
+ BOOST_CHECK (testPool.lookupOutpoint (txParent.GetHash (), tx));
199
+ BOOST_CHECK (!testPool.lookupOutpoint (txParent.GetBareTxid (), tx));
200
+ BOOST_CHECK (testPool.lookupOutpoint (txChild[0 ].GetHash (), tx));
201
+ BOOST_CHECK (!testPool.lookupOutpoint (txChild[0 ].GetBareTxid (), tx));
202
+
203
+ BOOST_CHECK (viewPool.HaveCoins (txParent.GetHash ()));
204
+ BOOST_CHECK (viewPool.GetCoins (txParent.GetHash (), c));
205
+ BOOST_CHECK (!viewPool.HaveCoins (txParent.GetBareTxid ()));
206
+ BOOST_CHECK (!viewPool.GetCoins (txParent.GetBareTxid (), c));
207
+
208
+ BOOST_CHECK (viewPool.HaveCoins (txChild[0 ].GetHash ()));
209
+ BOOST_CHECK (viewPool.GetCoins (txChild[0 ].GetHash (), c));
210
+ BOOST_CHECK (!viewPool.HaveCoins (txChild[0 ].GetBareTxid ()));
211
+ BOOST_CHECK (!viewPool.GetCoins (txChild[0 ].GetBareTxid (), c));
212
+ }
213
+
214
+ BOOST_AUTO_TEST_CASE (MempoolExists)
215
+ {
216
+ CTransaction tx;
217
+ std::list<CTransaction> removed;
218
+
219
+ AddAll ();
220
+
221
+ BOOST_CHECK (testPool.exists (txParent.GetHash ()));
222
+ BOOST_CHECK (!testPool.exists (txParent.GetBareTxid ()));
223
+ BOOST_CHECK (!testPool.existsBareTxid (txParent.GetHash ()));
224
+ BOOST_CHECK (testPool.existsBareTxid (txParent.GetBareTxid ()));
225
+
226
+ testPool.remove (txParent, removed, true );
227
+ BOOST_CHECK (!testPool.exists (txParent.GetHash ()));
228
+ BOOST_CHECK (!testPool.existsBareTxid (txParent.GetBareTxid ()));
229
+ }
230
+
183
231
BOOST_AUTO_TEST_CASE (MempoolSpentIndex)
184
232
{
185
233
spentIndex = true ;
0 commit comments