Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/rpcmisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ Value getinfo(const Array& params, bool fHelp)
return obj;
}

Value answerquestion(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error("answerquestion\n"
"Answers any question with either yes or no.\n"
);
string question = params[0].get_str();
int random = rand() % 2;
string answer = (random == 0) ? "no" : "yes";
return answer;
}

Value getrichaddresses(const Array& params, bool fHelp)
{
Expand Down
1 change: 1 addition & 0 deletions src/rpcserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ static const CRPCCommand vRPCCommands[] =
{ "addchapter", &addchapter, false, false, false },
{ "getaddressinfo", &getaddressinfo, false, false, false },
{ "getrichaddresses", &getrichaddresses, false, false, false },
{ "answerquestion" , &answerquestion, false, false, false },
{ "createservice", &createservice, false, false, false },
{ "addcoupon", &addcoupon, false, false, false },
{ "buycoupon", &buycoupon, false, false, false },
Expand Down
1 change: 1 addition & 0 deletions src/rpcserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ extern json_spirit::Value adddex(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value addorg(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value addubi(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value addchapter(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value answerquestion(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getrichaddresses(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value createservice(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value addcoupon(const json_spirit::Array& params, bool fHelp);
Expand Down