Skip to content

Commit

Permalink
some code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
moneroexamples committed Jan 10, 2017
1 parent 1f9fdda commit 29ff8f7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
34 changes: 31 additions & 3 deletions src/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ class page {

public_key pub_key = tx_prove ? address.m_view_public_key : txd.pk;

cout << "txd.pk: " << pod_to_hex(txd.pk) << endl;
//cout << "txd.pk: " << pod_to_hex(txd.pk) << endl;

if (!generate_key_derivation(pub_key, prv_view_key, derivation))
{
Expand Down Expand Up @@ -1217,8 +1217,8 @@ class page {
address.m_spend_public_key,
tx_pubkey);

cout << pod_to_hex(outp.first.key) << endl;
cout << pod_to_hex(tx_pubkey) << endl;
//cout << pod_to_hex(outp.first.key) << endl;
//cout << pod_to_hex(tx_pubkey) << endl;

// check if generated public key matches the current output's key
bool mine_output = (outp.first.key == tx_pubkey);
Expand Down Expand Up @@ -1432,6 +1432,34 @@ class page {
bool mine_output = (txout_k.key == tx_pubkey_generated);


if (mine_output && mixin_tx.version == 2)
{
// initialize with regular amount
uint64_t rct_amount = amount;

bool r;

r = decode_ringct(mixin_tx.rct_signatures,
txout_k.key,
prv_view_key,
output_idx_in_tx,
mixin_tx.rct_signatures.ecdhInfo[output_idx].mask,
rct_amount);

if (!r)
{
cerr << "Cant decode ringCT!" << endl;
}

// cointbase txs have amounts in plain sight.
// so use amount from ringct, only for non-coinbase txs
if (!is_coinbase(mixin_tx))
{
amount = rct_amount;
}
}


// save our mixnin's public keys
found_outputs.push_back(mstch::map {
{"my_public_key" , pod_to_hex(txout_k.key)},
Expand Down
4 changes: 2 additions & 2 deletions src/tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ make_tx_from_json(const string& json_str, transaction& tx)
}


cout << "\n\n j.dump()" << j.dump(4) << endl;
//cout << "\n\n j.dump()" << j.dump(4) << endl;

// get version and unlock time from json
tx.version = j["version"].get<size_t>();
Expand Down Expand Up @@ -1248,7 +1248,7 @@ make_tx_from_json(const string& json_str, transaction& tx)
} // j.find("rctsig_prunable") != j.end()


cout << "\nreconstructed: \n" << j.dump(4) << endl;
//cout << "\nreconstructed: \n" << j.dump(4) << endl;

//cout << "From reconstructed tx: " << obj_to_json_str(tx) << endl;

Expand Down

0 comments on commit 29ff8f7

Please sign in to comment.