Commit Graph

11314 Commits

Author SHA1 Message Date
Jack Grigg
22ffe8ce44 Remove now-unshadowed serialization lines that do nothing
Previously we had both nVersion as a class parameter *and* a serialization
argument, and in several inherited serializers the latter was set to the former,
in order to pass the serialized object's version into underlying parsers. #3180
pulled in the upstream changes to clean this up, and in doing so these lines
became no-ops - setting the class parameter to itself. Clang throws warnings on
this, which turn into errors on the MacOS builder.

We can just remove these, because upstream already had done so in earlier PRs,
indicating that they were not being relied on by underlying parsers.
2018-04-20 09:48:33 +01:00
Homu
0753a0e8a9 Auto merge of #3180 - str4d:transaction-serialization, r=ebfull
Upstream serialization improvements

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#5264
- bitcoin/bitcoin#6914
- bitcoin/bitcoin#6215
- bitcoin/bitcoin#8068
  - Only the `COMPACTSIZE` wrapper commit
- bitcoin/bitcoin#8658
- bitcoin/bitcoin#8708
  - Only the serializer variadics commit
- bitcoin/bitcoin#9039
- bitcoin/bitcoin#9125
  - Only the first two commits (the last two block on other upstream PRs)

Part of #2074.
2018-04-18 19:08:34 -07:00
Homu
b3f2da18ef Auto merge of #3184 - str4d:b6820-univalue-subdir, r=str4d
build: univalue subdir build fixups

Backported from bitcoin/bitcoin#6820.
2018-04-18 08:22:59 -07:00
Cory Fields
da96e3b71a build: univalue subdir build fixups
- Force a rebuild if the headers change
- Only build the lib target
- Clean univalue on 'make clean'
2018-04-18 00:36:49 +01:00
Pieter Wuille
c7d71985c9 Add deserializing constructors to CTransaction and CMutableTransaction 2018-04-17 13:29:51 +01:00
Pieter Wuille
40cc9aa7dd Add serialization for unique_ptr and shared_ptr 2018-04-17 13:09:48 +01:00
Pieter Wuille
87a5975ca0 Use fixed preallocation instead of costly GetSerializeSize
Dbwrapper used GetSerializeSize() to compute the size of the buffer
to preallocate. For some cases (specifically: CCoins) this requires
a costly compression call. Avoid this by just using fixed size
preallocations instead.
2018-04-17 13:09:48 +01:00
Pieter Wuille
098917052d Add optimized CSizeComputer serializers
To get the advantages of faster GetSerializeSize() implementations
back that were removed in "Make GetSerializeSize a wrapper on top of
CSizeComputer", reintroduce them in the few places in the form of a
specialized Serialize() implementation. This actually gets us in a
better state than before, as these even get used when they're invoked
indirectly in the serialization of another object.
2018-04-17 13:09:48 +01:00
Pieter Wuille
93aaf4fc94 Make CSerAction's ForRead() constexpr
The CSerAction's ForRead() method does not depend on any runtime
data, so guarantee that requests to it can be optimized out by
making it constexpr.

Suggested by Cory Fields.
2018-04-17 13:09:48 +01:00
Pieter Wuille
9b228f0391 Avoid -Wshadow errors
Suggested by Pavel Janik.
2018-04-17 13:09:48 +01:00
Jack Grigg
68a1a592ca Remove nType and nVersion from Zcash-specific code 2018-04-17 13:09:47 +01:00
Pieter Wuille
242f1421db Get rid of nType and nVersion
Remove the nType and nVersion as parameters to all serialization methods
and functions. There is only one place where it's read and has an impact
(in CAddress), and even there it does not impact any of the recursively
invoked serializers.

Instead, the few places that need nType or nVersion are changed to read
it directly from the stream object, through GetType() and GetVersion()
methods which are added to all stream classes.
2018-04-17 13:09:28 +01:00
Homu
ec6021950d Auto merge of #3176 - daira:use-https-for-bdb, r=daira
Use https: for BDB backup download URL.
2018-04-17 02:13:10 -07:00
Homu
0066c317b4 Auto merge of #3160 - bitcartel:3134_least_authority_issue_e, r=daira
Closes #3134 - Least Authority Issue E

CTxMemPool::check() does nothing when turned on, due to overflow.
2018-04-16 11:25:43 -07:00
Homu
012344249b Auto merge of #3175 - ca333:patch-4, r=daira
[fix] proton download path

resolves #3174
2018-04-16 09:47:39 -07:00
Jack Grigg
a8e5ae92ba GetSerializeSize changes in Zcash-specific code 2018-04-16 07:38:38 -06:00
Pieter Wuille
b8a6579366 Make GetSerializeSize a wrapper on top of CSizeComputer
Given that in default GetSerializeSize implementations created by
ADD_SERIALIZE_METHODS we're already using CSizeComputer(), get rid
of the specialized GetSerializeSize methods everywhere, and just use
CSizeComputer. This removes a lot of code which isn't actually used
anywhere.

For CCompactSize and CVarInt this actually removes a more efficient
size computing algorithm, which is brought back in a later commit.
2018-04-16 07:38:38 -06:00
Pieter Wuille
7f4acac433 Make nType and nVersion private and sometimes const
Make the various stream implementations' nType and nVersion private
and const (except in CDataStream where we really need a setter).
2018-04-16 07:38:37 -06:00
Pieter Wuille
1315591c85 Make streams' read and write return void
The stream implementations had two cascading layers (the upper one
with operator<< and operator>>, and a lower one with read and write).
The lower layer's functions are never cascaded (nor should they, as
they should only be used from the higher layer), so make them return
void instead.
2018-04-16 07:38:37 -06:00
Pieter Wuille
670a7686a6 Remove unused ReadVersion and WriteVersion
CDataStream and CAutoFile had a ReadVersion and WriteVersion method
that was never used. Remove them.
2018-04-16 07:38:37 -06:00
Cory Fields
d1c9ef8606 serialization: teach serializers variadics
Also add a variadic CDataStream ctor for ease-of-use.
2018-04-16 07:38:37 -06:00
Pavel Janík
ead36d85c7 [WIP] Remove unused statement in serialization
Zcash: Excludes changes to CBanEntry and CHDChain, which we don't have yet.
2018-04-16 07:38:37 -06:00
Matt Corallo
c803fa1094 Add COMPACTSIZE wrapper similar to VARINT for serialization 2018-04-16 07:38:37 -06:00
Jonas Schnelli
6cbe2c482c add bip32 pubkey serialization
CExtPubKey should be serializable like CPubKey
2018-04-16 07:38:36 -06:00
Jack Grigg
d2fb34fb7c Handle usage of prevector for CScript in Zcash-specific code 2018-04-16 07:38:36 -06:00
Pieter Wuille
29a8ade782 Prevector type 2018-04-16 07:38:36 -06:00
mruddy
690d38f0f8 Resolve issue bitcoin/bitcoin#3166.
These changes decode valid SIGHASH types on signatures in assembly (asm) representations of scriptSig scripts.
This squashed commit incorporates substantial helpful feedback from jtimon, laanwj, and sipa.
2018-04-16 07:38:36 -06:00
ca333
2b0e6432fe update proton.mk
use SSL/TLS secured URL
2018-04-16 15:24:42 +02:00
Daira Hopwood
7709c8a47e Use https: for BDB backup download URL. 2018-04-16 08:11:40 +01:00
ca333
d2f9e747d5 [fix] proton download path
resolves #3174
2018-04-16 00:19:33 +02:00
Homu
312f70091b Auto merge of #3169 - ebfull:sapling-global-params, r=str4d
Import sapling global parameters

This will also test the API a bit by invoking the Pedersen hashes.

Part of #3053.
2018-04-14 18:35:11 -07:00
Sean Bowe
65dc30c5a1 Update librustzcash hash 2018-04-14 19:33:10 -06:00
Homu
1594c845f5 Auto merge of #3157 - bitcartel:2966_extend_sprout_tests_part_2, r=str4d
Part of #2966, extending Sprout tests to other epochs

This continues the work started in PR #3109.
2018-04-14 16:36:30 -07:00
Homu
ceb4559eac Auto merge of #2784 - kozyilmaz:fetch, r=str4d
[macOS] added curl download method to fetch-params.sh

added curl download method and flock workaround for macOS

Part of #2246.
2018-04-14 14:38:07 -07:00
Homu
8be9d79c21 Auto merge of #3153 - str4d:default-disable-libs, r=str4d
Disable building libzcashconsensus by default

The library is not currently a supported build artifact; it needs work in
order to build on certain platforms (e.g. MacOS), and its dependencies need to
be narrowed down (Equihash is not a requirement for validating scripts).
2018-04-14 13:04:35 -07:00
Sean Bowe
341b775b19 Link with -ldl 2018-04-13 22:26:24 -06:00
Sean Bowe
395bcd3647 Invoke the merkle_hash API in librustzcash via test suite. 2018-04-13 22:26:22 -06:00
Homu
65a8f9f201 Auto merge of #3086 - str4d:cli-binary-improvements-1, r=str4d
CLI binary improvements

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#5936
- bitcoin/bitcoin#7550
- bitcoin/bitcoin#7989
- bitcoin/bitcoin#7957
- bitcoin/bitcoin#9067
- bitcoin/bitcoin#9220

Excludes any changes that affected the QT code.
2018-04-12 20:46:05 -07:00
Jack Grigg
ee6220c0ed [Bitcoin-Tx] Adjust util-test test cases for Zcash 2018-04-12 19:36:48 -06:00
Sean Bowe
e6bbd8481e Switch to latest librustzcash 2018-04-12 18:52:00 -06:00
Jack Grigg
abf5dd31af Add static asserts to ensure CONTINUE_EXECUTION doesn't collide 2018-04-12 18:11:46 -06:00
Karl-Johan Alm
3b26f5c361 Removed using namespace std from bitcoin-cli/-tx and added std:: in appropriate places. 2018-04-12 18:10:04 -06:00
UdjinM6
c06245c1e3 Every main()/exit() should return/use one of EXIT_ codes instead of magic numbers 2018-04-12 18:10:04 -06:00
UdjinM6
fadbbe1e04 Fix exit codes:
- `--help`, `--version` etc should exit with `0` i.e. no error ("not enough args" case should still trigger an error)
- error reading config file should exit with `1`

Slightly refactor AppInitRPC/AppInitRawTx to return standard exit codes (EXIT_FAILURE/EXIT_SUCCESS) or CONTINUE_EXECUTION (-1)
2018-04-12 18:10:04 -06:00
Jonas Schnelli
f11fb32967 [Bitcoin-Tx] Add tests for sequence number support 2018-04-12 18:10:04 -06:00
Jonas Schnelli
c09d76ea3c [bitcoin-tx] allow to set nSequence number over the in= command 2018-04-12 18:10:04 -06:00
Jonas Schnelli
216e94fb24 [RPC] createrawtransaction: add option to set the sequence number per input 2018-04-12 18:10:04 -06:00
Puru
e8f5b0278e bitcoin-cli.cpp: Use symbolic constant for exit code 2018-04-12 18:10:04 -06:00
Wladimir J. van der Laan
5e39c5a655 doc: mention bitcoin-cli -stdin in release notes 2018-04-12 18:10:04 -06:00
Wladimir J. van der Laan
21e33231af rpc: Input-from-stdin mode for bitcoin-cli
Implements #7442 by adding an option `-stdin` which reads
additional arguments from stdin, one per line.

For example

```bash
echo -e "mysecretcode\n120" | src/bitcoin-cli -stdin walletpassphrase
echo -e "walletpassphrase\nmysecretcode\n120" | src/bitcoin-cli -stdin
```
2018-04-12 18:08:17 -06:00