fixed pre-rct out .rct field empty detection

pull/22/head
Paul Shapiro 5 years ago
parent 57c6e6cc32
commit 966f137d30

@ -283,7 +283,7 @@ void monero_transfer_utils::send_step1__prepare_params_for_get_decoys(
// TODO: factor this out to get spendable balance for display in the MM wallet:
while (using_outs_amount < potential_total && remaining_unusedOuts.size() > 0) {
auto out = pop_random_value(remaining_unusedOuts);
if (!use_rct && out.rct != none) {
if (!use_rct && (out.rct != none && (*out.rct).empty() == false)) {
// out.rct is set by the server
continue; // skip rct outputs if not creating rct tx
}
@ -292,7 +292,7 @@ void monero_transfer_utils::send_step1__prepare_params_for_get_decoys(
// cout << "Not sweeping, and found a dusty (though maybe mixable) output... skipping it!" << endl;
continue;
}
if (out.rct == none) { // Sweeping, and found a dusty but unmixable (non-rct) output... skipping it!
if (out.rct == none || (*out.rct).empty()) { // Sweeping, and found a dusty but unmixable (non-rct) output... skipping it!
// cout << "Sweeping, and found a dusty but unmixable (non-rct) output... skipping it!" << endl;
continue;
} else {
@ -496,7 +496,7 @@ void monero_transfer_utils::create_transaction(
}
auto src = tx_source_entry{};
src.amount = outputs[out_index].amount;
src.rct = outputs[out_index].rct != none;
src.rct = outputs[out_index].rct != none && (*(outputs[out_index].rct)).empty() == false;
//
typedef cryptonote::tx_source_entry::output_entry tx_output_entry;
if (mix_outs.size() != 0) {
@ -527,12 +527,12 @@ void monero_transfer_utils::create_transaction(
}
oe.second.dest = rct::pk2rct(public_key);
//
if (mix_out__output.rct != boost::none) {
if (mix_out__output.rct != boost::none && (*(mix_out__output.rct)).empty() == false) {
rct::key commit;
_rct_hex_to_rct_commit(*mix_out__output.rct, commit);
oe.second.mask = commit;
} else {
if (outputs[out_index].rct != boost::none) {
if (outputs[out_index].rct != boost::none && (*(outputs[out_index].rct)).empty() == false) {
retVals.errCode = mixRCTOutsMissingCommit;
return;
}
@ -555,7 +555,7 @@ void monero_transfer_utils::create_transaction(
}
real_oe.second.dest = rct::pk2rct(public_key);
//
if (outputs[out_index].rct != none) {
if (outputs[out_index].rct != none && (*(outputs[out_index].rct)).empty() == false) {
rct::key commit;
_rct_hex_to_rct_commit(*(outputs[out_index].rct), commit);
real_oe.second.mask = commit; //add commitment for real input

@ -403,6 +403,9 @@ string serial_bridge::send_step1__prepare_params_for_get_decoys(const string &ar
out.amount = stoull(output_desc.second.get<string>("amount"));
out.public_key = output_desc.second.get<string>("public_key");
out.rct = output_desc.second.get_optional<string>("rct");
if (out.rct != none && (*out.rct).empty() == true) {
out.rct = none; // just in case it's an empty string, send to 'none' (even though receiving code now handles empty strs)
}
out.global_index = stoull(output_desc.second.get<string>("global_index"));
out.index = stoull(output_desc.second.get<string>("index"));
out.tx_pub_key = output_desc.second.get<string>("tx_pub_key");
@ -452,7 +455,7 @@ string serial_bridge::send_step1__prepare_params_for_get_decoys(const string &ar
auto& out_ptree = out_ptree_pair.second;
out_ptree.put("amount", RetVals_Transforms::str_from(out.amount));
out_ptree.put("public_key", out.public_key);
if (out.rct != none) {
if (out.rct != none && (*out.rct).empty() == false) {
out_ptree.put("rct", *out.rct);
}
out_ptree.put("global_index", RetVals_Transforms::str_from(out.global_index));
@ -481,6 +484,9 @@ string serial_bridge::send_step2__try_create_transaction(const string &args_stri
out.amount = stoull(output_desc.second.get<string>("amount"));
out.public_key = output_desc.second.get<string>("public_key");
out.rct = output_desc.second.get_optional<string>("rct");
if (out.rct != none && (*out.rct).empty() == true) {
out.rct = none; // send to 'none' if empty str for safety
}
out.global_index = stoull(output_desc.second.get<string>("global_index"));
out.index = stoull(output_desc.second.get<string>("index"));
out.tx_pub_key = output_desc.second.get<string>("tx_pub_key");

Loading…
Cancel
Save