Commit Graph

107 Commits

Author SHA1 Message Date
Jack Grigg
f7d78fdde1 Fix failing test 2016-09-01 20:16:18 +12:00
Jack Grigg
268bd84f9a Add coverage of the assertion inside GetNoteWitnesses() 2016-09-01 15:04:57 +12:00
Jack Grigg
5abaca1af6 Fix the failing test! 2016-09-01 13:00:02 +12:00
Jack Grigg
ac91ebbe92 Add test showing that the witness cache isn't being serialised 2016-09-01 12:47:44 +12:00
Jack Grigg
32a103aab7 Changes after review 2016-09-01 11:48:15 +12:00
Jack Grigg
0736fa14fc Keep any existing cached witnesses when updating transactions 2016-08-31 21:16:59 +12:00
Jack Grigg
1551db870a Add transactions to wallet if we spend notes in them 2016-08-31 18:28:00 +12:00
Jack Grigg
38a6e7a74d Set witness cache size equal to coinbase maturity duration
Both constants have the same implicit assumption: that the blockchain will very
rarely undergo a reorganisation of that size.
2016-08-31 15:26:49 +12:00
Jack Grigg
ad20f2149a mapNullifiers -> mapNullifiersToNotes for clarity 2016-08-31 15:11:35 +12:00
Jack Grigg
4086e5ce98 Replace vAnchorCache with a cache size counter
The anchor is obtained from the returned witnesses; since all witnesses are to
the same point (the latest blockchain tip), they all have the same root.
2016-08-31 15:03:42 +12:00
Jack Grigg
3fac1020e7 Remove GetNoteDecryptors(), lock inside FindMyNotes() instead 2016-08-31 02:09:17 +12:00
Jack Grigg
de42390f90 Pass ZCIncrementalMerkleTree to wallet to prevent race conditions 2016-08-31 02:00:11 +12:00
Jack Grigg
769e031c1a Update cached incremental witnesses when the active block chain tip changes 2016-08-30 00:29:49 +12:00
Jack Grigg
be74c80deb Add caching of incremental witnesses for spendable notes 2016-08-30 00:29:49 +12:00
Jack Grigg
8db7e25c3f Create mapping from nullifiers to received notes
This is used in the same way as CTxIn.prevout (e.g. to mark transactions dirty).
2016-08-30 00:29:49 +12:00
Jack Grigg
0f1060478f Keep track of spent notes, and detect and report conflicts 2016-08-30 00:29:49 +12:00
Jack Grigg
c3a7307a69 Store mapping between notes and PaymentAddresses in CWalletTx 2016-08-30 00:29:49 +12:00
Jack Grigg
02e674555e Add wallet method for finding spendable notes in a CTransaction 2016-08-30 00:29:49 +12:00
Simon
3bff998b38 Rename methods to avoid using prefix of _ underscore which is reserved.
Added logging of explicit exception rather than a catch all.
Removed redundant spending key check.
Updated user facing help message.
2016-08-24 11:55:26 -07:00
Simon
309b0ecd80 Add "zkey" to list of key types (used by the wallet to decide
whether or not it can be recovered if it detects bad records).
2016-08-24 11:19:34 -07:00
Simon
79d769a382 Remove one line of dead code. 2016-08-24 11:19:34 -07:00
Simon
2e0cc87acf Fix comment. 2016-08-24 11:19:34 -07:00
Simon
0feffd1424 Don't mark wallet as dirty if key already exists.
Fix incorrect method name used in error message.
2016-08-24 11:19:33 -07:00
Simon
e709997ff2 Implemented z_listaddresses to return all the zaddr in the wallet. 2016-08-24 11:19:33 -07:00
Simon
92444edc00 Add z_importwallet and z_exportwallet to handle keys for both
taddr and zaddr.  Restore behaviour of dumpwallet and importwallet
to only handle taddr.
2016-08-24 11:19:33 -07:00
Simon
c1c4594371 Implemented RPC calls z_importkey, z_exportkey, z_getnewaddress.
Modified RPC calls dumpwallet and importwallet to include spending keys.
2016-08-24 11:19:33 -07:00
zkbot
95277e0311 Auto merge of #1144 - bitcartel:zc.v0.11.2.z7_tx_malleability_gettxid, r=bitcartel
A fix for transaction malleability

This PR fixes transaction malleability by not including the sigscript of transaction inputs and joinsplit sigs when hashing the txid.

This PR supercedes PR #1101 which was a minimal solution based on a new serialization flag.

This PR introduces GetTxid() to distinguish between getting a transaction id and the double sha256 hash.

The key changes are:
- Adding GetTxid() method to CTransaction which makes a copy of the transaction, clearing out the sigscript and joinsplitsig fields, before hashing.
- Verifying that every call to GetHash() actually wants a txid, and replacing with GetTxid().
- Renaming GetHash() to GetSerializeHash()
  - Rationale: In future, upstream code we want to merge will use GetHash() but we don't know the intent.  We should check to see if the intent is to receive a txid (most likely) in which case we replace with GetTxid(), or if upstream actually wants a double hash of the transaction we can use GetSerializeHash().
- Updated genesis data in chainparams.cpp

Note that coinbase transactions are excluded as they need the sigscript hashed to help avoid duplicate txids per BIP34:
  - This modification is related to a question from @ebfull on PR #1101 - "Can we think of a way this change allows us to construct two transactions with the same txid which can simultaneously appear in the blockchain? My guess is it would be possible to construct a coinbase transaction of such a form... this surely breaks invariants."

This PR Passes all tests in test_bitcoin (test data was updated in bloom_tests, miner_tests and script_tests).
2016-08-05 19:31:52 +00:00
Jack Grigg
f7478de67f Add thread parameter to solveequihash benchmark
Closes #1147
2016-08-05 15:05:38 +12:00
Simon
eae3794152 Update deprecation message for zcraw api. 2016-07-27 21:40:26 -07:00
Simon
10d2c57c0d Replace calls to GetHash() with GetTxid() for transaction objects.
Where the caller intends to receive a transaction id and not a double
SHA256 hash.
2016-07-26 17:13:03 -07:00
Simon
a24a2e1144 Inform user that zcraw... rpc calls are being deprecated. 2016-07-24 10:05:20 -07:00
zkbot
b83061544f Auto merge of #1116 - ebfull:performance-check-valid-pour-fix, r=ebfull
Introduce `zcsamplejoinsplit` for creating a raw joinsplit description

We need this to generate joinsplits for use in the performance measurements. The current measurements for *memory usage* of verification are wrong now that we're computing the joinsplit before verifying: https://speed.z.cash/timeline/?exe=1&base=1%2B9&ben=memory+verifyjoinsplit&env=1&revs=50&equid=off&quarts=on&extr=on

This PR fixes that.
2016-07-20 00:03:46 +00:00
Taylor Hornby
67f0243533 Remove in-band error signalling from SignatureHash, fixing the SIGHASH_SINGLE bug. 2016-07-19 16:36:35 -06:00
Sean Bowe
1737627c4e Introduce zcsamplejoinsplit for creating a raw joinsplit description, and use it to construct the joinsplit for the performance tests that verify joinsplits. 2016-07-19 15:49:11 -06:00
Sean Bowe
22de160219 Fixes for indentation and local variable names. 2016-07-18 10:07:29 -06:00
Daira Hopwood
4bc00dc141 Bucket -> note.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-07-18 10:06:18 -06:00
Sean Bowe
b7e4abd6f7 Rename some usage of 'pour'. 2016-07-18 10:06:18 -06:00
Sean Bowe
8675d94b63 Rename vpour to vjoinsplit. 2016-07-18 10:06:18 -06:00
Sean Bowe
a8c68ffe99 Rename CPourTx to JSDescription. 2016-07-18 10:06:18 -06:00
Sean Bowe
35f82c35fe Rename samplepour to samplejoinsplit 2016-07-11 11:33:14 -06:00
Sean Bowe
2fbbde597c Always check valid joinsplits during performance tests, and avoid recomputing them every time we change the circuit. 2016-07-09 14:31:43 -06:00
Sean Bowe
9c45b501ad Make validatelargetx test more accurate, reduce block size limit to 1MB for now. 2016-07-06 12:07:50 -06:00
Jack Grigg
f5edc37f3f Add performance tests for creating and validating a MAX_BLOCK_SIZE transaction 2016-06-21 13:48:04 +12:00
Sean Bowe
0d6864e465 Added encoding for Zcash spending keys. 2016-06-15 16:03:57 -06:00
Sean Bowe
e104fcddf8 Use base58check to encode Zcash payment addresses, such that the first two bytes are "zc". 2016-06-15 14:59:05 -06:00
Sean Bowe
320f2cc7e0 Switch to Ed25519 for cryptographic binding of joinsplits to transactions. 2016-05-30 11:05:55 -06:00
Taylor Hornby
a138f81404 Implement signature verification in CheckTransaction 2016-05-30 11:05:43 -06:00
Taylor Hornby
6aae9d1a55 Sign JoinSplit transactions 2016-05-30 11:05:31 -06:00
Sean Bowe
ccb439c510 Protect-style joinsplits should anchor to the latest root for now, until #604 is resolved. 2016-05-12 16:44:49 -06:00
Sean Bowe
2dc3599271 Transplant of libzcash. 2016-05-12 16:44:47 -06:00