]> Git Repo - VerusCoin.git/commitdiff
Reduce use of global pzcashParams with private member variable
authorSimon <[email protected]>
Wed, 7 Sep 2016 05:59:14 +0000 (22:59 -0700)
committerSimon <[email protected]>
Fri, 9 Sep 2016 04:46:14 +0000 (21:46 -0700)
src/wallet/asyncrpcoperation_sendmany.cpp
src/wallet/asyncrpcoperation_sendmany.h

index 63896bd7cdadd27160ab18d6b639190a7121acba..f73d515ea5b8a1d7565f8db9849c9fba9f66ddea 100644 (file)
@@ -71,6 +71,8 @@ AsyncRPCOperation_sendmany::AsyncRPCOperation_sendmany(
             throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("runtime error: ") + e.what());
         }
     }
+    
+    zcashParams_ = pzcashParams; // global
 }
 
 AsyncRPCOperation_sendmany::~AsyncRPCOperation_sendmany() {
@@ -447,7 +449,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
 
                 // Decrypt the change note's ciphertext to retrieve some data we need
                 ZCNoteDecryption decryptor(spendingkey_.viewing_key());
-                auto hSig = prevJoinSplit.h_sig(*pzcashParams, tx_.joinSplitPubKey);
+                auto hSig = prevJoinSplit.h_sig(*zcashParams_, tx_.joinSplitPubKey);
                 try {
                     NotePlaintext plaintext = NotePlaintext::decrypt(
                             decryptor,
@@ -729,7 +731,7 @@ bool AsyncRPCOperation_sendmany::find_unspent_notes() {
             }
 
              // determine amount of funds in the note
-            auto hSig = wtx.vjoinsplit[i].h_sig(*pzcashParams, wtx.joinSplitPubKey);
+            auto hSig = wtx.vjoinsplit[i].h_sig(*zcashParams_, wtx.joinSplitPubKey);
             try {
                 NotePlaintext plaintext = NotePlaintext::decrypt(
                         decryptor,
@@ -832,7 +834,7 @@ Object AsyncRPCOperation_sendmany::perform_joinsplit(
             );
 
     // Generate the proof, this can take over a minute.
-    JSDescription jsdesc(*pzcashParams,
+    JSDescription jsdesc(*zcashParams_,
             joinSplitPubKey_,
             anchor,
             {info.vjsin[0], info.vjsin[1]},
@@ -883,7 +885,7 @@ Object AsyncRPCOperation_sendmany::perform_joinsplit(
         ss2 << ((unsigned char) 0x00);
         ss2 << jsdesc.ephemeralKey;
         ss2 << jsdesc.ciphertexts[0];
-        ss2 << jsdesc.h_sig(*pzcashParams, joinSplitPubKey_);
+        ss2 << jsdesc.h_sig(*zcashParams_, joinSplitPubKey_);
 
         encryptedNote1 = HexStr(ss2.begin(), ss2.end());
     }
@@ -892,7 +894,7 @@ Object AsyncRPCOperation_sendmany::perform_joinsplit(
         ss2 << ((unsigned char) 0x01);
         ss2 << jsdesc.ephemeralKey;
         ss2 << jsdesc.ciphertexts[1];
-        ss2 << jsdesc.h_sig(*pzcashParams, joinSplitPubKey_);
+        ss2 << jsdesc.h_sig(*zcashParams_, joinSplitPubKey_);
 
         encryptedNote2 = HexStr(ss2.begin(), ss2.end());
     }
index df10a2cee2759b283d9382dc9d18a67ac085ef33..28329f269d48de0c847c879d94ec5d0af6437508 100644 (file)
@@ -69,7 +69,7 @@ private:
     
     uint256 joinSplitPubKey_;
     unsigned char joinSplitPrivKey_[crypto_sign_SECRETKEYBYTES];
-
+    ZCJoinSplit *zcashParams_;
         
     std::vector<SendManyRecipient> t_outputs_;
     std::vector<SendManyRecipient> z_outputs_;
This page took 0.030057 seconds and 4 git commands to generate.