Auto merge of #1911 - bitcartel:1823_witness_does_not_have_same_anchor_as_change_input, r=str4d

With chained joinsplits, witness anchors for input notes no longer cross block boundaries

Closes #1823
This commit is contained in:
zkbot
2016-12-08 01:23:40 +00:00
4 changed files with 165 additions and 8 deletions

View File

@@ -14,6 +14,7 @@
#include "json/json_spirit_value.h"
#include "wallet.h"
#include <unordered_map>
#include <tuple>
// Default transaction fee if caller does not specify one.
@@ -41,6 +42,12 @@ struct AsyncJoinSplitInfo
CAmount vpub_new = 0;
};
// A struct to help us track the witness and anchor for a given JSOutPoint
struct WitnessAnchorData {
boost::optional<ZCIncrementalWitness> witness;
uint256 anchor;
};
class AsyncRPCOperation_sendmany : public AsyncRPCOperation {
public:
AsyncRPCOperation_sendmany(std::string fromAddress, std::vector<SendManyRecipient> tOutputs, std::vector<SendManyRecipient> zOutputs, int minDepth, CAmount fee = ASYNC_RPC_OPERATION_DEFAULT_MINERS_FEE);
@@ -71,7 +78,9 @@ private:
uint256 joinSplitPubKey_;
unsigned char joinSplitPrivKey_[crypto_sign_SECRETKEYBYTES];
// The key is the result string from calling JSOutPoint::ToString()
std::unordered_map<std::string, WitnessAnchorData> jsopWitnessAnchorMap;
std::vector<SendManyRecipient> t_outputs_;
std::vector<SendManyRecipient> z_outputs_;
std::vector<SendManyInputUTXO> t_inputs_;