Commit Graph
7732 Commits
Author SHA1 Message Date
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
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
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
Sean Bowe 395bcd3647 Invoke the merkle_hash API in librustzcash via test suite. 2018-04-13 22:26:22 -06:00
MarcoFalke 3c1db17064 [uacomment] Sanitize per BIP-0014
* SanitizeString() can be requested to be more strict
* Throw error when SanitizeString() changes uacomments
* Fix tests
2018-04-13 07:41:50 -06:00
Pavol Rusnak 2bc62dc4e3 limit total length of user agent comments
Reworked-By: Wladimir J. van der Laan <laanwj@gmail.com>
2018-04-13 07:40:34 -06:00
Pavol Rusnak 8c5e229ac9 implement uacomment config parameter
which can add comments to user agent as per BIP-0014
2018-04-13 07:40:34 -06:00
Jack Grigg ee6220c0ed [Bitcoin-Tx] Adjust util-test test cases for Zcash 2018-04-12 19:36:48 -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 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
Tom Harding 6c9d672f3c Add optional locktime to createrawtransaction
A non-zero locktime also causes input sequences to be set to
non-max, activating the locktime.
2018-04-12 18:08:17 -06:00
Jack Grigg 176fada24d Add Sapling to upgrade list 2018-04-12 12:13:05 -06:00
Homu 42e3025237 Auto merge of #3165 - str4d:release-v1.1.0, r=str4d
Release v1.1.0
2018-04-12 08:55:29 -07:00
Jack Grigg 39ee63c876 When rewinding, reset pindexBestInvalid if it is pointing to a removed block 2018-04-11 21:46:58 -06:00
Jack Grigg 4d234cd2f8 Overwinter mainnet activation height 2018-04-11 20:21:45 -06:00
Jack Grigg f64c346eca make-release.py: Versioning changes for 1.1.0. 2018-04-11 20:02:10 -06:00
Simon a0c977ca61 Closes #3134 - Least Authority Issue E
CTxMemPool::check() does nothing when turned on, due to overflow.
2018-04-10 20:45:36 -07:00
Simon 61624ed05d Part of #2966, extending Sprout tests to other epochs.
This continues the work started in PR #3109.
2018-04-09 16:17:30 -07:00
Homu 079d9e6a57 Auto merge of #3149 - str4d:release-v1.1.0-rc1, r=str4d
Release v1.1.0-rc1
2018-04-05 04:36:15 -07:00
Jack Grigg ecf544d062 Set Overwinter protocol version to 170005
170004 is the protocol version for the NODE_BLOOM change, which is being
"released" in this RC. The activation height is being set in the final release,
which means that we may end up with both RC and final release versions online
when Overwinter activates. Bumping the protocol version for Overwinter enables
RC nodes to be correctly disconnected.
2018-04-05 12:07:44 +01:00
Simon 6901d30830 Fix test to check for sanitized string from alertnotify.
If client version is 1.1.0-rc1, the alertnotify message will have
been sanitized and will show as 1.1.0rc1.
2018-04-04 21:55:20 -07:00
Jack Grigg 5e11533408 make-release.py: Versioning changes for 1.1.0-rc1. 2018-04-05 03:08:20 +01:00
R E Broadley 4f31d82395 Allow filterclear messages for enabling TX relay only.
An example of where this might be useful is allowing a node to connect blocksonly during IBD but then becoming a full-node once caught up with the latest block. This might also even want to be the default behaviour since during IBD most TXs appear to be orphans, and are routinely dropped (for example when a node disconnects). Therefore, this can waste a lot of bandwidth.

Additionally, another pull could be written to stop relaying of TXs to nodes that are clearly far behind the latest block and are running a node that doesn't store many orphan TXs, such as recent versions of Bitcoin Core.
2018-04-05 01:30:38 +01:00
Jack Grigg 2b7fcab8fc Move bloom filter filtering logic back into command "switch" 2018-04-05 01:30:38 +01:00
Jack Grigg 0a284ecaf6 Fix NODE_BLOOM documentation errors 2018-04-05 01:30:38 +01:00
Matt Corallo 1c82adeb87 Don't do mempool lookups for "mempool" command without a filter 2018-04-05 01:30:12 +01:00
Patick Strateman b976ce7cee Document both the peerbloomfilters and enforcenodebloom options. 2018-04-05 01:30:12 +01:00
Patick Strateman f07ad43553 Add enforcenodebloom option.
Previously peers which implement a protocol version less than NO_BLOOM_VERSION
would not be disconnected for sending a filter command, regardless of the
peerbloomfilter option.

Many node operators do not wish to provide expensive bloom filtering for SPV
clients, previously they had to cherry pick the commit which enabled the
disconnect logic.

The default should remain false until a sufficient percent of SPV clients
have updated.
2018-04-05 01:30:12 +01:00
Patick Strateman d06ae252a0 Move bloom filter filtering logic outside of command "switch" (giant if/else).
Moving this logic outside of the "switch" makes it far simpler to
enable the forced disconnect by a parameter.
2018-04-05 01:30:12 +01:00
Matt Corallo 8bc4461326 Add NODE_BLOOM service bit and bump protocol version
Lets nodes advertise that they offer bloom filter support explicitly.
The protocol version bump allows SPV nodes to assume that NODE_BLOOM is
set if NODE_NETWORK is set for pre-170004 nodes.

Also adds an option to turn bloom filter support off for nodes which
advertise a version number >= 170004. Nodes attempting to use bloom
filters on such protocol versions are banned, and a later upgade
should drop nodes of an older version which attempt to use bloom
filters.

Much code stolen from Peter Todd.

Zcash: Implements Zcash equivalent of BIP 111; deploys with Overwinter
2018-04-05 01:30:12 +01:00
Homu f5b1082f9c Auto merge of #3148 - str4d:DOS-mitigation-tx-expiry, r=str4d
Don't increase banscore for expired transactions if they only just expired

Closes #3141.
2018-04-04 15:46:25 -07:00
Jack Grigg 8a22734ec1 test: Check return value of snprintf 2018-04-04 19:18:23 +01:00
Simon 7cc423522f Bump MIT Licence copyright header. 2018-04-04 10:16:06 -07:00