Dupcheck fix

This commit is contained in:
Fabian Schuh 2019-02-07 16:20:43 +01:00
parent 9946eab684
commit 5e352238c4
No known key found for this signature in database
GPG key ID: F2538A4B282D6238

View file

@ -149,25 +149,6 @@ std::vector<block_id_type> database::get_block_ids_on_fork(block_id_type head_of
return result;
}
void database::check_tansaction_for_duplicated_operations(const signed_transaction& trx)
{
const auto& proposal_index = get_index<proposal_object>();
std::set<fc::sha256> existed_operations_digests;
proposal_index.inspect_all_objects( [&](const object& obj){
const proposal_object& proposal = static_cast<const proposal_object&>(obj);
auto proposed_operations_digests = gather_proposed_operations_digests( proposal.proposed_transaction );
existed_operations_digests.insert( proposed_operations_digests.begin(), proposed_operations_digests.end() );
});
/// FIXME / TODO: Migrate this check to a new API call to leave a broadcast call that does not do dupchecks
auto proposed_operations_digests = gather_proposed_operations_digests(trx);
for (auto& digest: proposed_operations_digests)
{
FC_ASSERT(existed_operations_digests.count(digest) == 0, "Proposed operation is already pending for approval.");
}
}
/**
* Push block "may fail" in which case every partial change is unwound. After
* push block is successful the block is appended to the chain database on disk.