diff --git a/libraries/core_libs/network/include/network/tarcap/packets/latest/pillar_votes_bundle_packet.hpp b/libraries/core_libs/network/include/network/tarcap/packets/latest/pillar_votes_bundle_packet.hpp index af5aa0a6f2..bf2bf1f632 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets/latest/pillar_votes_bundle_packet.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets/latest/pillar_votes_bundle_packet.hpp @@ -3,14 +3,17 @@ #include "common/encoding_rlp.hpp" #include "network/tarcap/packets_handlers/latest/common/exceptions.hpp" #include "vote/pillar_vote.hpp" +#include "vote/votes_bundle_rlp.hpp" namespace taraxa::network::tarcap { struct PillarVotesBundlePacket { - // TODO[2870]: optimize rlp size (use custom class), see encodePillarVotesBundleRlp std::vector> pillar_votes; - RLP_FIELDS_DEFINE_INPLACE(pillar_votes) + void rlp(::taraxa::util::RLPDecoderRef encoding) { pillar_votes = decodePillarVotesBundleRlp(encoding.value); } + void rlp(::taraxa::util::RLPEncoderRef encoding) const { + encoding.appendRaw(encodePillarVotesBundleRlp(pillar_votes)); + } }; } // namespace taraxa::network::tarcap diff --git a/libraries/core_libs/network/include/network/tarcap/packets/latest/votes_bundle_packet.hpp b/libraries/core_libs/network/include/network/tarcap/packets/latest/votes_bundle_packet.hpp index 261b5a52a6..a05f519e88 100644 --- a/libraries/core_libs/network/include/network/tarcap/packets/latest/votes_bundle_packet.hpp +++ b/libraries/core_libs/network/include/network/tarcap/packets/latest/votes_bundle_packet.hpp @@ -2,21 +2,15 @@ #include "network/tarcap/packets_handlers/latest/common/exceptions.hpp" #include "vote/pbft_vote.hpp" +#include "vote/votes_bundle_rlp.hpp" namespace taraxa::network::tarcap { struct VotesBundlePacket { - // TODO[2870]: Create votes bundles class - // blk_hash_t votes_bundle_block_hash; - // PbftPeriod votes_bundle_pbft_period; - // PbftRound votes_bundle_pbft_round; - // PbftStep votes_bundle_votes_step; - std::vector> votes; - // RLP_FIELDS_DEFINE_INPLACE(votes_bundle_block_hash, votes_bundle_pbft_period, votes_bundle_pbft_round, - // votes_bundle_votes_step, votes) - RLP_FIELDS_DEFINE_INPLACE(votes) + void rlp(::taraxa::util::RLPDecoderRef encoding) { votes = decodePbftVotesBundleRlp(encoding.value); } + void rlp(::taraxa::util::RLPEncoderRef encoding) const { encoding.appendRaw(encodePbftVotesBundleRlp(votes)); } }; } // namespace taraxa::network::tarcap