Changeset View
Changeset View
Standalone View
Standalone View
src/client/clientutil.cpp
| Show All 10 Lines | |||||
| namespace Kazv | namespace Kazv | ||||
| { | { | ||||
| std::string increaseTxnId(std::string cur) | std::string increaseTxnId(std::string cur) | ||||
| { | { | ||||
| return std::to_string(std::stoull(cur) + 1); | return std::to_string(std::stoull(cur) + 1); | ||||
| } | } | ||||
| std::string getTxnId(Event event, ClientModel &m) | std::string getTxnId(Event /* event */, ClientModel &m) | ||||
| { | { | ||||
| auto origJson = event.originalJson().get(); | auto txnId = | ||||
| std::to_string(std::chrono::system_clock::now() | |||||
| auto txnId = std::to_string(std::hash<json>{}(origJson)) | |||||
| + std::to_string(std::chrono::system_clock::now() | |||||
| .time_since_epoch().count()) | .time_since_epoch().count()) | ||||
| + m.nextTxnId; | + m.nextTxnId; | ||||
| m.nextTxnId = increaseTxnId(m.nextTxnId); | m.nextTxnId = increaseTxnId(m.nextTxnId); | ||||
| return txnId; | return txnId; | ||||
| } | } | ||||
| } | } | ||||