Commit Graph

118 Commits

Author SHA1 Message Date
Simon
5020a93631 Refactoring: rename NotePlaintext --> SproutNotePlaintext
Also renames:
CNotePlaintextEntry --> CSproutNotePlaintextEntry
CUnspentNotePlaintextEntry --> CUnspentSproutNotePlaintextEntry
2018-04-26 15:05:30 -07:00
Homu
347804fe73 Auto merge of #3106 - braddmiller:3046-mergetoaddress-concurrent, r=str4d
Add Note Locking to z_mergetoaddress

Adds note locking to `z_mergetoaddress` allowing it to be invoked multiple times before previous `z_mergetoaddress` operations have finished.

Reference issue [#3046](https://github.com/zcash/zcash/issues/3046)

Co-authored-by: Eirik Ogilvie-Wigley <eirik@z.cash>
2018-03-30 14:29:17 -07:00
Homu
72f14060bc Auto merge of #3098 - str4d:2343-overwinter-disable-mempooltxinputlimit, r=str4d
Ignore -mempooltxinputlimit once Overwinter activates

Overwinter changes the SignatureHash function to solve the quadratic hashing problem, so this option will no longer be needed.
2018-03-30 08:33:58 -07:00
Brad Miller
4e6400bc00 Implement note locking for z_mergetoaddress
Co-authored-by: Eirik Ogilvie-Wigley <eirik@z.cash>
2018-03-29 15:48:34 -06:00
Simon
d72c19a662 Closes #2910. Add z_listunspent RPC call. 2018-03-28 10:38:57 -07:00
Jack Grigg
31afbcc5c9 Ignore -mempooltxinputlimit once Overwinter activates 2018-03-28 14:25:42 +02:00
Jay Graber
7b92f27e18 Add expiry to z_mergetoaddress 2018-02-23 15:15:46 -08:00
Jay Graber
9bb37bf0d5 Implement transaction expiry for Overwinter 2018-02-23 00:12:03 -08:00
Jack Grigg
bdbe8e8591 Extend CWallet::GetFilteredNotes to enable filtering on a set of addresses 2018-02-20 13:19:07 +00:00
Jack Grigg
be12669982 Add consensus branch ID parameter to SignatureHash, remove SigVersion parameter
We do not need to be able to calculate multiple SignatureHash versions for a
single transaction format; instead, we use the transaction format to determine
the SigVersion.

The consensus branch ID *does* need to be passed in from the outside, as only
the caller knows the context in which the SignatureHash is being calculated
(ie. mempool acceptance vs. block validation).

JoinSplit signature verification has been moved into ContextualCheckTransaction,
where the consensus branch ID can be obtained.

The argument to the sign command for zcash-tx has been modified to take a height
in addition to the optional sigtype flags.
2018-02-20 04:22:20 +00:00
Jack Grigg
e005ff83ab Remove P2WPKH and P2WSH from signing logic
Separated from the previous commit for ease of review.
2018-02-20 04:22:19 +00:00
Pieter Wuille
157a5d0d9c BIP143: Signing logic 2018-02-20 04:22:19 +00:00
Simon
072099d788 Implementation of Overwinter transaction format ZIP 202. 2018-02-16 10:10:15 -08:00
Jack Grigg
bec2235148 Cleanup: Add braces for clarity 2017-12-20 11:18:59 +00:00
Jack Grigg
9a2b8ae57f Update wallet logic to account for viewing keys
The wallet code previously assumed that an unlocked wallet would always
have a spending key associated with a note decryptor. Viewing keys break
this assumption.
2017-12-20 00:46:37 +00:00
Jack Grigg
167cd33374 Implement viewing key storage in the wallet 2017-12-20 00:46:37 +00:00
Jack Grigg
642a1caf93 ViewingKey -> ReceivingKey per zcash/zips#117 2017-12-04 17:17:18 +00:00
Simon
9e84b5aa0d Check mempooltxinputlimit when creating a transaction to avoid local
mempool rejection.
2017-06-17 14:41:25 -07:00
zkbot
a7cf698873 Auto merge of #2100 - str4d:2074-rpc, r=arcalinea
Bitcoin 0.12 RPC PRs 1

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6266
- bitcoin/bitcoin#6257
- bitcoin/bitcoin#6271
- bitcoin/bitcoin#6158
- bitcoin/bitcoin#6307
- bitcoin/bitcoin#6290
- bitcoin/bitcoin#6262
- bitcoin/bitcoin#6088
- bitcoin/bitcoin#6339
- bitcoin/bitcoin#6299 (partial, remainder in #2099)
- bitcoin/bitcoin#6350
- bitcoin/bitcoin#6247
- bitcoin/bitcoin#6362
- bitcoin/bitcoin#5486
- bitcoin/bitcoin#6417
- bitcoin/bitcoin#6398 (partial, remainder was included in #1950)
- bitcoin/bitcoin#6444
- bitcoin/bitcoin#6456 (partial, remainder was included in #2082)
- bitcoin/bitcoin#6380
- bitcoin/bitcoin#6970

Part of #2074.
2017-03-04 02:57:46 +00:00
Philip Kaufmann
db954a65ac use const references where appropriate 2017-03-03 10:57:05 -08:00
Matt Corallo
aa30f65502 Add FundTransaction method to wallet
Some code stolen from Jonas Schnelli <jonas.schnelli@include7.ch>
2017-03-02 13:23:03 -08:00
zkbot
dff700c1af Auto merge of #2055 - str4d:1545-note-decryption-error-class, r=daira
Use a more specific exception class for note decryption failure

Closes #1545.
2017-02-08 03:12:37 +00:00
Jack Grigg
51fde9ea08 Use a more specific exception class for note decryption failure
Closes #1545.
2017-01-31 23:05:19 +01:00
Jack Grigg
207924a1d5 Remove OpenSSL PRNG reseeding
Per https://download.libsodium.org/doc/generating_random_data/ reseeding the
default libsodium PRNG is not required.
2017-01-23 17:06:54 +01:00
Jack Grigg
c0ec0e756b Fix bug in IncrementNoteWitness() 2016-12-13 22:53:52 +13:00
Jack Grigg
6f78f4f44c Only check cache validity for witnesses being incremented or decremented
Fixes the bug resulting from #1904.
2016-12-13 09:34:55 +13:00
Jack Grigg
9d2cc3a784 Make the test pass by fixing the bug! 2016-12-10 00:56:32 +13:00
Jack Grigg
03f83b9b0d Write witness caches when writing the best block
For steady-state operation, this reduces the average time between wallet disk
writes from once per block to once per hour.

On -rescan, witness caches are only written out at the end along with the best
block, increasing speed while ensuring that on-disk state is kept consistent.

Witness caches are now never recreated during a -reindex, on the assumption that
the blocks themselves are not changing (the chain is just being reconstructed),
and so the witnesses will remain valid.

Part of #1749.
2016-11-30 14:04:37 +13:00
Jack Grigg
a4ef3aa9b5 Clear witnessHeight and nWitnessCacheSize in ClearNoteWitnessCache 2016-11-15 17:53:41 +13:00
Jack Grigg
ccfd8aae1d Add code comments about CNoteData::witnessHeight 2016-11-15 16:42:22 +13:00
Jack Grigg
4a6a48479d Copy over CNoteData::witnessHeight when updating wallet tx 2016-11-15 14:08:41 +13:00
Jack Grigg
40ef121e6a Correctly set CNoteData::witnessHeight when decrementing witness caches
Closes #1715
2016-11-15 14:08:35 +13: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
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