Commit Graph

68 Commits

Author SHA1 Message Date
Jack Grigg
6216b4b2dc WriteWitnessCache: Catch errors and abort transaction
Closes #1456
2016-10-05 09:49:43 -05:00
zkbot
4f49d32a28 Auto merge of #1427 - bitcartel:master_1345_getbalance, r=bitcartel
Fixes #1345 so that RPC getbalance star calculates balance of UTXOs correctly.
2016-10-04 01:20:12 -04:00
Simon
86cf60b5c8 Fixes #1345 so that UTXO debit and credits are computed correctly for a transaction. 2016-10-03 11:06:43 -07:00
zkbot
d5dce9342b Auto merge of #1444 - str4d:1394-reindex-clear-witness-caches, r=str4d
Clear note witness caches on reindexing

This PR also fixes a test that was passing arguments in the wrong order.

Closes #1394
2016-09-30 02:30:01 -04:00
Simon
82bd9ee81b Fix comment and formatting per review 2016-09-29 22:07:38 -07:00
Simon
2aa9c0253a Update to use new API in CCryptoKeyStore and store a viewing key in walletdb. 2016-09-29 20:17:30 -07:00
Simon
73699ceaf6 Add support for spending keys to the encrypted wallet. 2016-09-29 20:17:30 -07:00
Jack Grigg
40600f5089 Simplify ClearNoteWitnessCache() 2016-09-30 15:00:16 +13:00
zkbot
42941c9fd4 Auto merge of #1445 - bitcartel:master_fix_filtered_notes, r=str4d
Fix casting error in GetFilteredNotes

Use int for minDepth like upstream instead of size_t which can lead to casting problems if a wallet tx has a depth of -1.
Also don't use FindMyNotes as mapNoteData has already been set on wallet tx.

@str4d As dicussed. This should be merged before other PRs related to wallet.
2016-09-29 05:33:11 -04:00
Jack Grigg
56fb1bb8e4 Write note witness cache atomically to disk to avoid corruption
Closes #1378
2016-09-28 11:51:42 +13:00
Simon
dec49d1f82 Fix GetFilteredNotes to use int for minDepth like upstream and avoid casting problems. Don't use FindMyNotes as mapNoteData has already been set on wallet tx. 2016-09-27 11:14:49 -07:00
Jack Grigg
76b226586e Add wallet method to clear the note witness cache 2016-09-27 14:55:05 +13:00
Simon
1b141933e5 Rename GetUnspentNotes to GetFilteredNotes
Added parameter to ignore spent notes, which is true by default.
2016-09-08 21:46:15 -07:00
Simon
a5ac2e25a0 Add GetUnspentNotes to wallet. 2016-09-08 21:46:14 -07:00
Simon
97b6f365a1 Fix bug where wallet was not persisting witnesses to disk.
Author: str4d
2016-09-08 21:46:14 -07:00
Jack Grigg
ac1c94350d Refactor wallet note code for testing 2016-09-08 17:17:35 +12:00
Simon
fa511e1084 Replace GetTxid() with GetHash() after rebase on latest. 2016-09-07 15:12:20 -07:00
Simon
805344dcf4 Refactor: replace calls to GetTxid() with GetHash() 2016-09-07 15:12:09 -07: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
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
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
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
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
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
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
Sean Bowe
1760b3cd88 Deprecate the old tree and remove old tree tests from the test suite. 2016-04-28 16:07:52 -06:00
Sean Bowe
434f328446 Integrate new incremental merkle tree implementation into consensus. 2016-04-28 16:07:52 -06:00
Sean Bowe
cf47198370 Fixed a couple incremental merkle tree bugs breaking consistency checks. 2016-01-19 14:36:10 -07:00
Sean Bowe
a8ac403db0 Added mapAnchors consensus rules, finished zcrawpour/zcrawreceive.
Some specifics on consensus changes:
* Transactions must be anchored to a real anchor in the chain.
* Anchors are pushed and popped during ConnectBlock/DisconnectBlock as appropriate.
* DisconnectTip triggers evictions, under some circumstances, of transactions in the
  mempool which are anchored to roots that are no longer valid.
* Commitments append to the tree at the current best root during ConnectBlock.
2016-01-19 14:36:04 -07:00
Wladimir J. van der Laan
7ff9d122e4 Make sure LogPrintf strings are line-terminated
Fix the cases where LogPrint[f] was accidentally called without line
terminator, which resulted in concatenated log lines.

(see e.g. #6492)
2015-09-22 00:43:11 +00:00
Peter Todd
75a4d512cf Fix off-by-one error w/ nLockTime in the wallet
Previously due to an off-by-one error the wallet ignored
nLockTime-by-height transactions that would be valid in the next block
even though they are accepted into the mempool. The transactions
wouldn't show up until confirmed, nor would they be included in the
unconfirmed balance. Similar to the mempool behavior fix in 665bdd3b,
the wallet code was calling IsFinalTx() directly without taking into
account the fact that doing so tells you if the transaction could have
been mined in the *current* block, rather than the next block.

To fix this we strip IsFinalTx() of non-consensus-critical
functionality, removing the default arguments, and add CheckFinalTx() to
check if a transaction will be final in the next block.

Github-Pull: #6183
Rebased-From: 28bf06236d3b385e95fe26a7a742395b30efd6ee
2015-06-01 12:35:49 +02:00
Wladimir J. van der Laan
c7c9af381c Merge pull request #5669
da29ecb Consensus: MOVEONLY: Move CValidationState from main consensus/validation (jtimon)
27afcd8 Consensus: Refactor: Decouple CValidationState from main::AbortNode() (Cory Fields)
2015-05-27 15:00:02 +02:00
Wladimir J. van der Laan
77ed59df4d wallet: Introduce constant for -txconfirmtarget default 2015-05-18 09:00:24 +02:00
jtimon
da29ecbcc6 Consensus: MOVEONLY: Move CValidationState from main consensus/validation 2015-05-15 16:05:28 +02:00