diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 933c4fac43..3b9e743e18 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -2432,14 +2432,32 @@ UniValue addkey(const UniValue& params, bool fHelp) break; } case GRC::ContractType::PROTOCOL: - // There will be no legacy payload contracts past version 2. This will need to be changed before the - // block v13 mandatory (which also means contract v3). - contract = GRC::MakeLegacyContract( - type.Value(), - action, - params[2].get_str(), // key - params[3].get_str()); // value + { + if (block_v13_enabled) { + GRC::ProtocolEntryStatus status = GRC::ProtocolEntryStatus::UNKNOWN; + + if (action == GRC::ContractAction::ADD) { + status = GRC::ProtocolEntryStatus::ACTIVE; + } else if (action == GRC::ContractAction::REMOVE) { + status = GRC::ProtocolEntryStatus::DELETED; + } + + contract = GRC::MakeContract( + contract_version, + action, + uint32_t {2}, // Contract payload version number + params[2].get_str(), // key + params[3].get_str(), // value + status); + } else { + contract = GRC::MakeLegacyContract( + type.Value(), + action, + params[2].get_str(), // key + params[3].get_str()); // value + } break; + } case GRC::ContractType::SIDESTAKE: { if (block_v13_enabled) {