Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Test should honor existing compression
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Dec 18, 2018
1 parent 4ef3527 commit 04e276c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions unittests/block_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ std::pair<signed_block_ptr, signed_block_ptr> corrupt_trx_in_block(validating_te

// Make a copy of the valid block and corrupt the transaction
auto copy_b = std::make_shared<signed_block>(b->clone());
auto signed_tx = copy_b->transactions.back().trx.get<packed_transaction>().get_signed_transaction();
const auto& packed_trx = copy_b->transactions.back().trx.get<packed_transaction>();
auto signed_tx = packed_trx.get_signed_transaction();
// Corrupt one signature
signed_tx.signatures.clear();
signed_tx.sign(main.get_private_key(act_name, "active"), main.control->get_chain_id());

// Replace the valid transaction with the invalid transaction
auto invalid_packed_tx = packed_transaction(signed_tx);
auto invalid_packed_tx = packed_transaction(signed_tx, packed_trx.get_compression());
copy_b->transactions.back().trx = invalid_packed_tx;

// Re-calculate the transaction merkle
Expand Down

0 comments on commit 04e276c

Please sign in to comment.