Implemented hp-sc comm channel. (#32)

This commit is contained in:
Ravin Perera
2019-10-17 16:06:35 +05:30
committed by GitHub
parent 7c068ecb85
commit fb236d44be
4 changed files with 247 additions and 144 deletions

View File

@@ -108,7 +108,8 @@ int main(int argc, char **argv)
while (true)
{
sleep(1);
sleep(2);
// Test code to execute contract and collect outputs.
std::unordered_map<std::string, std::pair<std::string, std::string>> userbufs;
for (auto &[sid, user] : usr::users)
@@ -121,8 +122,10 @@ int main(int argc, char **argv)
bufpair.first = std::move(inputtosend);
userbufs[user.pubkey] = bufpair;
}
std::pair<std::string, std::string> hpscbufpair;
hpscbufpair.first = "{msg:'Message from HP'}";
proc::ContractExecArgs eargs(123123345, userbufs);
proc::ContractExecArgs eargs(123123345, userbufs, hpscbufpair);
proc::exec_contract(eargs);
for (auto &[pubkey, bufpair] : userbufs)
@@ -139,6 +142,9 @@ int main(int argc, char **argv)
}
}
if (!hpscbufpair.second.empty())
std::cout << "Message from SC: " << hpscbufpair.second << std::endl;
userbufs.clear();
}