Follow required transaction signatures order
This commit is contained in:
parent
3745d3fba2
commit
d185fe36c3
1 changed files with 30 additions and 19 deletions
|
|
@ -271,28 +271,39 @@ void sidechain_net_handler::process_sidechain_transactions() {
|
||||||
std::for_each(idx_range.first, idx_range.second, [&](const sidechain_transaction_object &sto) {
|
std::for_each(idx_range.first, idx_range.second, [&](const sidechain_transaction_object &sto) {
|
||||||
ilog("Sidechain transaction to process: ${sto}", ("sto", sto));
|
ilog("Sidechain transaction to process: ${sto}", ("sto", sto));
|
||||||
|
|
||||||
bool complete = false;
|
son_id_type invalid_signer = son_id_type(0xFFFFFFFF);
|
||||||
std::string processed_sidechain_tx = process_sidechain_transaction(sto, complete);
|
son_id_type next_signer = invalid_signer;
|
||||||
|
for (auto &signer : sto.signers) {
|
||||||
if (processed_sidechain_tx.empty()) {
|
if (signer.second == false) {
|
||||||
ilog("Sidechain transaction not processed: ${sto}", ("sto", sto));
|
next_signer = signer.first;
|
||||||
return;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sidechain_transaction_sign_operation sts_op;
|
if ((next_signer != invalid_signer) && (next_signer == plugin.get_current_son_id())) {
|
||||||
sts_op.payer = plugin.get_son_object(plugin.get_current_son_id()).son_account;
|
bool complete = false;
|
||||||
sts_op.sidechain_transaction_id = sto.id;
|
std::string processed_sidechain_tx = process_sidechain_transaction(sto, complete);
|
||||||
sts_op.transaction = processed_sidechain_tx;
|
|
||||||
sts_op.complete = complete;
|
|
||||||
|
|
||||||
signed_transaction trx = plugin.database().create_signed_transaction(plugin.get_private_key(plugin.get_current_son_id()), sts_op);
|
if (processed_sidechain_tx.empty()) {
|
||||||
trx.validate();
|
ilog("Sidechain transaction not processed: ${sto}", ("sto", sto));
|
||||||
try {
|
return;
|
||||||
plugin.database().push_transaction(trx, database::validation_steps::skip_block_size_check);
|
}
|
||||||
if (plugin.app().p2p_node())
|
|
||||||
plugin.app().p2p_node()->broadcast(net::trx_message(trx));
|
sidechain_transaction_sign_operation sts_op;
|
||||||
} catch (fc::exception e) {
|
sts_op.payer = plugin.get_son_object(plugin.get_current_son_id()).son_account;
|
||||||
ilog("sidechain_net_handler: sending proposal for sidechain transaction sign operation failed with exception ${e}", ("e", e.what()));
|
sts_op.sidechain_transaction_id = sto.id;
|
||||||
|
sts_op.transaction = processed_sidechain_tx;
|
||||||
|
sts_op.complete = complete;
|
||||||
|
|
||||||
|
signed_transaction trx = plugin.database().create_signed_transaction(plugin.get_private_key(plugin.get_current_son_id()), sts_op);
|
||||||
|
trx.validate();
|
||||||
|
try {
|
||||||
|
plugin.database().push_transaction(trx, database::validation_steps::skip_block_size_check);
|
||||||
|
if (plugin.app().p2p_node())
|
||||||
|
plugin.app().p2p_node()->broadcast(net::trx_message(trx));
|
||||||
|
} catch (fc::exception e) {
|
||||||
|
ilog("sidechain_net_handler: sending proposal for sidechain transaction sign operation failed with exception ${e}", ("e", e.what()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue