mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
fix
This commit is contained in:
parent
22ff220729
commit
14a4243478
@ -91,7 +91,7 @@ Poco::JSON::Object* JsonCreateTransaction::transfer(Poco::Dynamic::Var params)
|
|||||||
return customStateError("not found", "receiver not found");
|
return customStateError("not found", "receiver not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto user = mSession->getNewUser();
|
auto sender_user = mSession->getNewUser();
|
||||||
Poco::UInt32 amount = 0;
|
Poco::UInt32 amount = 0;
|
||||||
auto mm = MemoryManager::getInstance();
|
auto mm = MemoryManager::getInstance();
|
||||||
Poco::JSON::Object* result = nullptr;
|
Poco::JSON::Object* result = nullptr;
|
||||||
@ -122,17 +122,23 @@ Poco::JSON::Object* JsonCreateTransaction::transfer(Poco::Dynamic::Var params)
|
|||||||
result = stateError("user not in group", "receiver user isn't in target group");
|
result = stateError("user not in group", "receiver user isn't in target group");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto sender_user = mSession->getNewUser();
|
|
||||||
if (sender_user->getGradidoKeyPair()->isTheSame(*target_pubkey)) {
|
auto gradido_key_pair = sender_user->getGradidoKeyPair();
|
||||||
|
if (gradido_key_pair) {
|
||||||
|
if (gradido_key_pair->isTheSame(*target_pubkey)) {
|
||||||
result = stateError("sender and receiver are the same");
|
result = stateError("sender and receiver are the same");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("user hasn't valid key pair set\n");
|
||||||
|
}
|
||||||
if (!result) {
|
if (!result) {
|
||||||
try {
|
try {
|
||||||
auto transaction = model::gradido::Transaction::createTransfer(sender_user, target_pubkey, mTargetGroup, amount, mMemo, mBlockchainType);
|
auto transaction = model::gradido::Transaction::createTransfer(sender_user, target_pubkey, mTargetGroup, amount, mMemo, mBlockchainType);
|
||||||
|
|
||||||
if (mAutoSign) {
|
if (mAutoSign) {
|
||||||
Poco::JSON::Array errors;
|
Poco::JSON::Array errors;
|
||||||
transaction->sign(user);
|
transaction->sign(sender_user);
|
||||||
if (transaction->errorCount() > 0) {
|
if (transaction->errorCount() > 0) {
|
||||||
errors.add(transaction->getErrorsArray());
|
errors.add(transaction->getErrorsArray());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user