Skip to content

Commit

Permalink
Add CPubKey m_public_key to Poll class and serialize for payload v3
Browse files Browse the repository at this point in the history
Note this is for future use.
  • Loading branch information
jamescowens committed Jul 4, 2022
1 parent 5ae77b8 commit 0cf013d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/gridcoin/voting/payloads.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,11 @@ class PollPayload : public IContractPayload
READWRITE(m_version);
READWRITE(m_poll);

// The poll m_additional_fields is serialized here rather than in the poll class, because it depends on the
// payload version.
// The poll m_additional_fields and m_public_key are serialized here rather than in the poll class, because they
// depend on the payload version.
if (m_version >= 3) {
READWRITE(m_poll.m_additional_fields);
READWRITE(m_poll.m_public_key);
}

READWRITE(m_claim);
Expand Down
6 changes: 4 additions & 2 deletions src/gridcoin/voting/poll.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "gridcoin/voting/fwd.h"
#include "serialize.h"
#include "uint256.h"
#include "pubkey.h"

#include <string>
#include <vector>
Expand Down Expand Up @@ -390,6 +391,7 @@ class Poll
std::string m_question; //!< UTF-8 prompt that voters shall answer.
ChoiceList m_choices; //!< The set of possible answers to the poll.
AdditionalFieldList m_additional_fields; //!< The set of additional fields for the poll.
CPubKey m_public_key; //!< Public key of the project.

// Memory only:
int64_t m_timestamp; //!< Time of the poll's containing transaction.
Expand Down Expand Up @@ -558,8 +560,8 @@ class Poll
READWRITE(m_choices);
}

// Note that m_additional_fields is not serialized here, but rather in the PollPayload class. This
// is because it depends on the poll payload version, which is not available here.
// Note that m_additional_fields and m_public_key are not serialized here, but rather in the PollPayload class. This
// is because they depend on the poll payload version, which is not available here.
}
}; // Poll
} // namespace GRC
Expand Down

0 comments on commit 0cf013d

Please sign in to comment.