Commit Graph

249 Commits

Author SHA1 Message Date
jl777
47658758e1 test 2016-10-22 12:27:01 -03:00
jl777
fdbf481faf test 2016-10-22 11:56:19 -03:00
jl777
e42867d124 test 2016-10-22 11:38:25 -03:00
jl777
09c5c3d332 test 2016-10-22 10:31:05 -03:00
jl777
6ef202b24a test 2016-10-22 10:24:06 -03:00
jl777
8ad9f27fdd test 2016-10-21 18:32:52 -03:00
jl777
2897cc41e0 test 2016-10-21 18:28:28 -03:00
jl777
40cb0c7d41 test 2016-10-21 18:15:46 -03:00
jl777
560c5598be test 2016-10-21 18:03:15 -03:00
jl777
8c8552a2ab test 2016-10-21 15:48:46 -03:00
jl777
e19d8b3dee test 2016-10-21 15:20:30 -03:00
Jack Grigg
1b407cba2b Add heights to log output 2016-10-20 11:02:15 -05:00
Jack Grigg
878c4b1b50 Clear witness cache when re-witnessing notes
Closes #1378
2016-10-20 10:32:20 -05:00
jl777
f2dd868d93 test 2016-10-20 06:32:43 -03:00
jl777
482c3933ad test 2016-10-18 13:17:40 -03:00
Jack Grigg
b6961fc112 Increment witnesses for new transactions on rescan
Closes #1400
2016-10-17 09:55:02 -05:00
Daira Hopwood
95e32d88b0 Add another assertion about the witness cache.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-10-17 05:09:27 +01:00
Daira Hopwood
8e41408aa7 Add another assertion to narrow down where the bug occurs.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-10-17 05:09:27 +01:00
Daira Hopwood
8a7d37befd Move the increment of nWitnessCacheSize to make the later assertions correct.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2016-10-17 05:09:27 +01:00
Jack Grigg
83d7b5b67b Add more asserts to track down the bug 2016-10-17 05:09:27 +01:00
zkbot
ec8dc3a88a Auto merge of #1431 - bitcartel:master_1373_taddr_coinbase_error, r=bitcartel
Return a more informative error message when trying to spend coinbase; select non-coinbase inputs when sending to a transparent output if needed

For #1373 and #1519

Code change:
- Extra parameter added to AvailableCoins to include or exclude Coinbase coins.  Default value of parameter is 'true' as current behaviour is to include Coinbase coins.
- SelectCoins, used for sending taddr->taddr, will now exclude Coinbase coins.

Unit test:
Tried to write a test to focus on the extra parameter added to AvailableCoins but could not.

Empirical testing on Testnet:
Current behaviour is that upstream RPC commands sendfrom and sendtoaddress try to spend coinbase coins returned by AvailableCoins.  So the user will see:

```
./zcash-cli sendtoaddress mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 1000.0
error: {"code":-6,"message":"Insufficient funds"}

./zcash-cli sendtoaddress mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 0.00003000
error: {"code":-4,"message":"Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."}

./zcash-cli sendfrom "" mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 0.00003000
error: {"code":-4,"message":"Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."}
```

After fix is applied:

```
./zcash-cli sendtoaddress mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 1000.0
error: {"code":-6,"message":"Insufficient funds"}

./zcash-cli sendtoaddress mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 0.00003000
error: {"code":-4,"message":"Coinbase funds can only be sent to a zaddr"}
```

When non-coinbase UTXOs exist, they will now be selected and used:

```
./zcash-cli z_sendmany tnPJZHeVxegCg91utaquBRPEDBGjozfz9iLDHt7zvphFbZdspNgkTVLCGjDcadQBKNyUwKs8pNjDXuEZKrE1aNLpFwHgz4t '[{"address":"mx5fTRhLZwbYE7ZqhAPueZgQGSnwTbdvKU", "amount":0.01}]'

./zcash-cli sendtoaddress mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 1000.0
error: {"code":-6,"message":"Insufficient funds"}

./zcash-cli sendtoaddress mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 0.00003000
9818e543ac2f689d4ce8b52087607d73fecd771d45d316a1d9db092f0485aff2

./zcash-cli sendfrom "" mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 0.00003000
899f2894823f51f15fc73b5e0871ac943edbe0ff88e1635f86906087b72caf30
```
2016-10-16 22:08:07 -04:00
Simon
2b1cda3b6a Return improved error message when trying to spend Coinbase coins (#1373).
Extra parameter added to AvailableCoins to include or exclude Coinbase coins.
SelectCoins, used for sending taddr->taddr, will exclude Coinbase coins.

Added qa rpc test and a runtime parameter -regtestprotectcoinbase to enforce
the coinbase->zaddr consensus rule in regtest mode.
2016-10-16 19:05:56 -07:00
Jack Grigg
6e263a5fd3 Address review comments 2016-10-16 16:26:51 -05:00
Jack Grigg
a581fe2aae Only ignore runtime errors caused by failed note decryption 2016-10-14 17:16:09 -05:00
Jack Grigg
1a62587e9a Delay caching of nullifiers when wallet is locked
Closes #1502
2016-10-14 17:16:09 -05:00
zkbot
cc10005247 Auto merge of #1486 - str4d:1456-writewitnesscache-exception-safety, r=bitcartel
WriteWitnessCache: Catch errors and abort transaction

Closes #1452
2016-10-14 17:37:53 -04:00
zkbot
bb25bd4bc1 Auto merge of #1533 - bitcartel:master_1447_document_getfilterednotes, r=bitcartel
Document CWallet::GetFilteredNotes

Also fixes return type of method which should be void.

Part of #1447
2016-10-13 20:25:19 -04:00
Simon
cb0d208f6b Document CWallet::GetFilteredNotes and fix return type which should be
void.
2016-10-13 17:01:54 -07:00
Jack Grigg
e492d98632 Document CWalletTx::FindMyNotes
Part of #1447
2016-10-13 18:27:58 -05:00
Jack Grigg
82c2d97c60 Add unit tests for WriteWitnessCache
Requires moving implementation into header
2016-10-11 09:33:47 -05:00
Sean Bowe
74f15a73a1 Make 100KB transaction size limit a consensus rule, rather than a standard rule. 2016-10-08 00:00:23 -06:00
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