Skip to content

Commit

Permalink
7582: Loosen restriction to allow fewer or equal results than request…
Browse files Browse the repository at this point in the history
…ed, but not more

Signed-off-by: Matilda Clerke <[email protected]>
  • Loading branch information
Matilda-Clerke committed Jan 9, 2025
1 parent 9272872 commit 8b18e4b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public List<Transaction> processResponse(final MessageData messageData)
final PooledTransactionsMessage pooledTransactionsMessage =
PooledTransactionsMessage.readFrom(messageData);
final List<Transaction> responseTransactions = pooledTransactionsMessage.transactions();
if (responseTransactions.size() != hashes.size()) {
if (responseTransactions.size() > hashes.size()) {
throw new InvalidPeerTaskResponseException(
"Response transaction count does not match request hash count");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ public void testProcessResponse() throws InvalidPeerTaskResponseException {

@Test
public void testProcessResponseWithIncorrectTransactionCount() {
List<Hash> hashes = List.of(Hash.EMPTY, Hash.EMPTY_LIST_HASH);
List<Hash> hashes = List.of(Hash.EMPTY);
GetPooledTransactionsFromPeerTask task = new GetPooledTransactionsFromPeerTask(hashes);

Transaction transaction = GENERATOR.transaction();
PooledTransactionsMessage pooledTransactionsMessage =
PooledTransactionsMessage.create(List.of(transaction));
PooledTransactionsMessage.create(List.of(GENERATOR.transaction(), GENERATOR.transaction()));

InvalidPeerTaskResponseException exception =
Assertions.assertThrows(
Expand Down

0 comments on commit 8b18e4b

Please sign in to comment.