mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-22 00:00:55 +01:00
Compare commits
97 Commits
v24.2
...
v0.12.0rc2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1bc1d796be | ||
|
|
5df314b927 | ||
|
|
b16b5bc191 | ||
|
|
f4b2ce8ee8 | ||
|
|
7726c487f8 | ||
|
|
52b29dca76 | ||
|
|
da83ecd454 | ||
|
|
e25b158ab8 | ||
|
|
64612f1820 | ||
|
|
5bb3e263e2 | ||
|
|
621bbd88ba | ||
|
|
cda064caa1 | ||
|
|
fa311338d2 | ||
|
|
51af87f078 | ||
|
|
236686b844 | ||
|
|
44438a192a | ||
|
|
a74fa1f06b | ||
|
|
351ffd8482 | ||
|
|
c0d2382170 | ||
|
|
d8b062d752 | ||
|
|
d04525a065 | ||
|
|
1709cc5cb0 | ||
|
|
b0cb055673 | ||
|
|
8b7a0f88cb | ||
|
|
098fcb5694 | ||
|
|
1488fc8eac | ||
|
|
2e552b04c2 | ||
|
|
5cacb8f319 | ||
|
|
fa8c497d84 | ||
|
|
d7c54c5a9d | ||
|
|
fbea2f64e2 | ||
|
|
f17b00b66f | ||
|
|
e20704ba71 | ||
|
|
6f8346db5f | ||
|
|
605de4a88a | ||
|
|
6191a9b628 | ||
|
|
6307beb09f | ||
|
|
6092ff205b | ||
|
|
82667afd78 | ||
|
|
5771b71ca5 | ||
|
|
3d5cf698d6 | ||
|
|
a06a8b4888 | ||
|
|
2a3161bf8b | ||
|
|
afe825f075 | ||
|
|
071f704a70 | ||
|
|
fd4bd5009e | ||
|
|
2c5c2154c9 | ||
|
|
fab88af4d5 | ||
|
|
a36d79bfe2 | ||
|
|
8f25d6eb0e | ||
|
|
fa0a391b35 | ||
|
|
d570a1f41b | ||
|
|
a344880e6a | ||
|
|
5b144b7113 | ||
|
|
d513405cb7 | ||
|
|
4707797df2 | ||
|
|
9265e89a77 | ||
|
|
1320300ea1 | ||
|
|
fa4ba40d8c | ||
|
|
b1a8374aaa | ||
|
|
daa8da281b | ||
|
|
fabba1c1a4 | ||
|
|
ff9b610026 | ||
|
|
1ed938b5fe | ||
|
|
333e1eaeea | ||
|
|
5cadf3eb60 | ||
|
|
bfdaa3c87f | ||
|
|
e08b7cb33c | ||
|
|
3cb066c62b | ||
|
|
a75a03a5f2 | ||
|
|
bdd0f9e286 | ||
|
|
f6c8c1242b | ||
|
|
e70fc6f842 | ||
|
|
5ba42bad6d | ||
|
|
2d6a493493 | ||
|
|
76de36fd2e | ||
|
|
453c56701a | ||
|
|
9ef7c54ef0 | ||
|
|
301f16ad1c | ||
|
|
12c469b236 | ||
|
|
eccd67106d | ||
|
|
f3ad812208 | ||
|
|
9572e4944a | ||
|
|
fa8c8d7fa6 | ||
|
|
10b88be798 | ||
|
|
06c6a58463 | ||
|
|
f43c2f9a8a | ||
|
|
8fc174aae6 | ||
|
|
44fef99e66 | ||
|
|
96e8d12033 | ||
|
|
b2d7ada372 | ||
|
|
82aff880d3 | ||
|
|
f31955d9da | ||
|
|
6ba25d2886 | ||
|
|
cfb44ce97a | ||
|
|
2985000808 | ||
|
|
45b8e278fb |
@@ -95,6 +95,8 @@ Anyone may participate in peer review which is expressed by comments in the pull
|
||||
- Concept ACK means "I agree in the general principle of this pull request";
|
||||
- Nit refers to trivial, often non-blocking issues.
|
||||
|
||||
Reviewers should include the commit hash which they reviewed in their comments.
|
||||
|
||||
Project maintainers reserve the right to weigh the opinions of peer reviewers using common sense judgement and also may weight based on meritocracy: Those that have demonstrated a deeper commitment and understanding towards the project (over time) or have clear domain expertise may naturally have more weight, as one would expect in all walks of life.
|
||||
|
||||
Where a patch set affects consensus critical code, the bar will be set much higher in terms of discussion and peer review requirements, keeping in mind that mistakes could be very costly to the wider community. This includes refactoring of consensus critical code.
|
||||
|
||||
2
COPYING
2
COPYING
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
Copyright (c) 2009-2016 The Bitcoin Core developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -3,7 +3,7 @@ Bitcoin Core integration/staging tree
|
||||
|
||||
[](https://travis-ci.org/bitcoin/bitcoin)
|
||||
|
||||
https://www.bitcoin.org
|
||||
https://bitcoincore.org
|
||||
|
||||
What is Bitcoin?
|
||||
----------------
|
||||
@@ -21,7 +21,7 @@ License
|
||||
-------
|
||||
|
||||
Bitcoin Core is released under the terms of the MIT license. See [COPYING](COPYING) for more
|
||||
information or see http://opensource.org/licenses/MIT.
|
||||
information or see https://opensource.org/licenses/MIT.
|
||||
|
||||
Development Process
|
||||
-------------------
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
|
||||
AC_PREREQ([2.60])
|
||||
define(_CLIENT_VERSION_MAJOR, 0)
|
||||
define(_CLIENT_VERSION_MINOR, 11)
|
||||
define(_CLIENT_VERSION_REVISION, 99)
|
||||
define(_CLIENT_VERSION_MINOR, 12)
|
||||
define(_CLIENT_VERSION_REVISION, 0)
|
||||
define(_CLIENT_VERSION_BUILD, 0)
|
||||
define(_CLIENT_VERSION_IS_RELEASE, false)
|
||||
define(_COPYRIGHT_YEAR, 2015)
|
||||
define(_CLIENT_VERSION_IS_RELEASE, true)
|
||||
define(_COPYRIGHT_YEAR, 2016)
|
||||
AC_INIT([Bitcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/bitcoin/bitcoin/issues],[bitcoin])
|
||||
AC_CONFIG_SRCDIR([src/main.cpp])
|
||||
AC_CONFIG_HEADERS([src/config/bitcoin-config.h])
|
||||
|
||||
@@ -23,7 +23,7 @@ Build-Depends: debhelper,
|
||||
libprotobuf-dev, protobuf-compiler,
|
||||
python
|
||||
Standards-Version: 3.9.2
|
||||
Homepage: https://www.bitcoin.org/
|
||||
Homepage: https://bitcoincore.org/
|
||||
Vcs-Git: git://github.com/bitcoin/bitcoin.git
|
||||
Vcs-Browser: https://github.com/bitcoin/bitcoin
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ Upstream-Contact: Satoshi Nakamoto <satoshin@gmx.com>
|
||||
Source: https://github.com/bitcoin/bitcoin
|
||||
|
||||
Files: *
|
||||
Copyright: 2009-2015, Bitcoin Core Developers
|
||||
Copyright: 2009-2016, Bitcoin Core Developers
|
||||
License: Expat
|
||||
Comment: The Bitcoin Core Developers encompasses the current developers listed on bitcoin.org,
|
||||
as well as the numerous contributors to the project.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH BITCOIN-CLI "1" "February 2015" "bitcoin-cli 0.10"
|
||||
.TH BITCOIN-CLI "1" "February 2016" "bitcoin-cli 0.12"
|
||||
.SH NAME
|
||||
bitcoin-cli \- a remote procedure call client for Bitcoin Core.
|
||||
.SH SYNOPSIS
|
||||
@@ -11,31 +11,7 @@ This manual page documents the bitcoin-cli program. bitcoin-cli is an RPC client
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-?\fR
|
||||
Show the help message.
|
||||
.TP
|
||||
\fB\-conf=\fR<file>
|
||||
Specify configuration file (default: bitcoin.conf).
|
||||
.TP
|
||||
\fB\-datadir=\fR<dir>
|
||||
Specify data directory.
|
||||
.TP
|
||||
\fB\-testnet\fR
|
||||
Connect to a Bitcoin Core instance running in testnet mode.
|
||||
.TP
|
||||
\fB\-regtest\fR
|
||||
Connect to a Bitcoin Core instance running in regtest mode (see documentation for -regtest on bitcoind).
|
||||
.TP
|
||||
\fB\-rpcuser=\fR<user>
|
||||
Username for JSON\-RPC connections.
|
||||
.TP
|
||||
\fB\-rpcpassword=\fR<pw>
|
||||
Password for JSON\-RPC connections.
|
||||
.TP
|
||||
\fB\-rpcport=\fR<port>
|
||||
Listen for JSON\-RPC connections on <port> (default: 8332 or testnet: 18332).
|
||||
.TP
|
||||
\fB\-rpcconnect=\fR<ip>
|
||||
Send commands to node running on <ip> (default: 127.0.0.1).
|
||||
Show possible options.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBbitcoind\fP, \fBbitcoin.conf\fP
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH BITCOIN-QT "1" "April 2013" "bitcoin-qt 1"
|
||||
.TH BITCOIN-QT "1" "February 2016" "bitcoin-qt 0.12"
|
||||
.SH NAME
|
||||
bitcoin-qt \- peer-to-peer network based digital currency
|
||||
.SH DESCRIPTION
|
||||
@@ -8,184 +8,6 @@ bitcoin\-qt [command\-line options]
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\-?
|
||||
This help message
|
||||
.TP
|
||||
\fB\-conf=\fR<file>
|
||||
Specify configuration file (default: bitcoin.conf)
|
||||
.TP
|
||||
\fB\-pid=\fR<file>
|
||||
Specify pid file (default: bitcoind.pid)
|
||||
.TP
|
||||
\fB\-gen\fR
|
||||
Generate coins
|
||||
.TP
|
||||
\fB\-gen\fR=\fI0\fR
|
||||
Don't generate coins
|
||||
.TP
|
||||
\fB\-datadir=\fR<dir>
|
||||
Specify data directory
|
||||
.TP
|
||||
\fB\-dbcache=\fR<n>
|
||||
Set database cache size in megabytes (default: 25)
|
||||
.TP
|
||||
\fB\-timeout=\fR<n>
|
||||
Specify connection timeout in milliseconds (default: 5000)
|
||||
.TP
|
||||
\fB\-proxy=\fR<ip:port>
|
||||
Connect through SOCKS5 proxy
|
||||
.TP
|
||||
\fB\-tor=\fR<ip:port>
|
||||
Use proxy to reach tor hidden services (default: same as \fB\-proxy\fR)
|
||||
.TP
|
||||
\fB\-dns\fR
|
||||
Allow DNS lookups for \fB\-addnode\fR, \fB\-seednode\fR and \fB\-connect\fR
|
||||
.TP
|
||||
\fB\-port=\fR<port>
|
||||
Listen for connections on <port> (default: 8333 or testnet: 18333)
|
||||
.TP
|
||||
\fB\-maxconnections=\fR<n>
|
||||
Maintain at most <n> connections to peers (default: 125)
|
||||
.TP
|
||||
\fB\-addnode=\fR<ip>
|
||||
Add a node to connect to and attempt to keep the connection open
|
||||
.TP
|
||||
\fB\-connect=\fR<ip>
|
||||
Connect only to the specified node(s)
|
||||
.TP
|
||||
\fB\-seednode=\fR<ip>
|
||||
Connect to a node to retrieve peer addresses, and disconnect
|
||||
.TP
|
||||
\fB\-externalip=\fR<ip>
|
||||
Specify your own public address
|
||||
.TP
|
||||
\fB\-onlynet=\fR<net>
|
||||
Only connect to nodes in network <net> (IPv4, IPv6 or Tor)
|
||||
.TP
|
||||
\fB\-discover\fR
|
||||
Discover own IP address (default: 1 when listening and no \fB\-externalip\fR)
|
||||
.TP
|
||||
\fB\-checkpoints\fR
|
||||
Only accept block chain matching built\-in checkpoints (default: 1)
|
||||
.TP
|
||||
\fB\-listen\fR
|
||||
Accept connections from outside (default: 1 if no \fB\-proxy\fR or \fB\-connect\fR)
|
||||
.TP
|
||||
\fB\-bind=\fR<addr>
|
||||
Bind to given address and always listen on it. Use [host]:port notation for IPv6
|
||||
.TP
|
||||
\fB\-dnsseed\fR
|
||||
Find peers using DNS lookup (default: 1 unless \fB\-connect\fR)
|
||||
.TP
|
||||
\fB\-banscore=\fR<n>
|
||||
Threshold for disconnecting misbehaving peers (default: 100)
|
||||
.TP
|
||||
\fB\-bantime=\fR<n>
|
||||
Number of seconds to keep misbehaving peers from reconnecting (default: 86400)
|
||||
.TP
|
||||
\fB\-maxreceivebuffer=\fR<n>
|
||||
Maximum per\-connection receive buffer, <n>*1000 bytes (default: 5000)
|
||||
.TP
|
||||
\fB\-maxsendbuffer=\fR<n>
|
||||
Maximum per\-connection send buffer, <n>*1000 bytes (default: 1000)
|
||||
.TP
|
||||
\fB\-upnp\fR
|
||||
Use UPnP to map the listening port (default: 1 when listening)
|
||||
.TP
|
||||
\fB\-paytxfee=\fR<amt>
|
||||
Fee per KB to add to transactions you send
|
||||
.TP
|
||||
\fB\-server\fR
|
||||
Accept command line and JSON\-RPC commands
|
||||
.TP
|
||||
\fB\-testnet\fR
|
||||
Use the test network
|
||||
.TP
|
||||
\fB\-debug\fR
|
||||
Output extra debugging information. Implies all other \fB\-debug\fR* options
|
||||
.TP
|
||||
\fB\-debugnet\fR
|
||||
Output extra network debugging information
|
||||
.TP
|
||||
\fB\-logtimestamps\fR
|
||||
Prepend debug output with timestamp
|
||||
.TP
|
||||
\fB\-shrinkdebugfile\fR
|
||||
Shrink debug.log file on client startup (default: 1 when no \fB\-debug\fR)
|
||||
.TP
|
||||
\fB\-printtoconsole\fR
|
||||
Send trace/debug info to console instead of debug.log file
|
||||
.TP
|
||||
\fB\-rpcuser=\fR<user>
|
||||
Username for JSON\-RPC connections
|
||||
.TP
|
||||
\fB\-rpcpassword=\fR<pw>
|
||||
Password for JSON\-RPC connections
|
||||
.TP
|
||||
\fB\-rpcport=\fR<port>
|
||||
Listen for JSON\-RPC connections on <port> (default: 8332 or testnet: 18332)
|
||||
.TP
|
||||
\fB\-rpcallowip=\fR<ip>
|
||||
Allow JSON\-RPC connections from specified IP address
|
||||
.TP
|
||||
\fB\-rpcthreads=\fR<n>
|
||||
Set the number of threads to service RPC calls (default: 4)
|
||||
.TP
|
||||
\fB\-blocknotify=\fR<cmd>
|
||||
Execute command when the best block changes (%s in cmd is replaced by block hash)
|
||||
.TP
|
||||
\fB\-walletnotify=\fR<cmd>
|
||||
Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)
|
||||
.TP
|
||||
\fB\-alertnotify=\fR<cmd>
|
||||
Execute command when a relevant alert is received (%s in cmd is replaced by message)
|
||||
.TP
|
||||
\fB\-upgradewallet\fR
|
||||
Upgrade wallet to latest format
|
||||
.TP
|
||||
\fB\-keypool=\fR<n>
|
||||
Set key pool size to <n> (default: 100)
|
||||
.TP
|
||||
\fB\-rescan\fR
|
||||
Rescan the block chain for missing wallet transactions
|
||||
.TP
|
||||
\fB\-salvagewallet\fR
|
||||
Attempt to recover private keys from a corrupt wallet.dat
|
||||
.TP
|
||||
\fB\-checkblocks=\fR<n>
|
||||
How many blocks to check at startup (default: 288, 0 = all)
|
||||
.TP
|
||||
\fB\-checklevel=\fR<n>
|
||||
How thorough the block verification is (0\-4, default: 3)
|
||||
.TP
|
||||
\fB\-txindex\fR
|
||||
Maintain a full transaction index (default: 0)
|
||||
.TP
|
||||
\fB\-loadblock=\fR<file>
|
||||
Imports blocks from external blk000??.dat file
|
||||
.TP
|
||||
\fB\-reindex\fR
|
||||
Rebuild block chain index from current blk000??.dat files
|
||||
.TP
|
||||
\fB\-par=\fR<n>
|
||||
Set the number of script verification threads (1\-16, 0=auto, default: 0)
|
||||
.SS "Block creation options:"
|
||||
.TP
|
||||
\fB\-blockminsize=\fR<n>
|
||||
Set minimum block size in bytes (default: 0)
|
||||
.TP
|
||||
\fB\-blockmaxsize=\fR<n>
|
||||
Set maximum block size in bytes (default: 250000)
|
||||
.HP
|
||||
\fB\-blockprioritysize=\fR<n> Set maximum size of high\-priority/low\-fee transactions in bytes (default: 27000)
|
||||
.PP
|
||||
Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)
|
||||
.SS "UI options:"
|
||||
.TP
|
||||
\fB\-lang=\fR<lang>
|
||||
Set language, for example "de_DE" (default: system locale)
|
||||
.TP
|
||||
\fB\-min\fR
|
||||
Start minimized
|
||||
.TP
|
||||
\fB\-splash\fR
|
||||
Show splash screen on startup (default: 1)
|
||||
List options.
|
||||
.SH "SEE ALSO"
|
||||
bitcoind(1)
|
||||
|
||||
@@ -1,75 +1,15 @@
|
||||
.TH BITCOIN.CONF "5" "January 2011" "bitcoin.conf 3.19"
|
||||
.TH BITCOIN.CONF "5" "February 2016" "bitcoin.conf 0.12"
|
||||
.SH NAME
|
||||
bitcoin.conf \- bitcoin configuration file
|
||||
.SH SYNOPSIS
|
||||
All command-line options (except for '\-conf') may be specified in a configuration file, and all configuration file options may also be specified on the command line. Command-line options override values set in the configuration file.
|
||||
.TP
|
||||
The configuration file is a list of 'setting=value' pairs, one per line, with optional comments starting with the '#' character.
|
||||
The configuration file is a list of 'setting=value' pairs, one per line, with optional comments starting with the '#' character. Please refer to bitcoind(1) for a up to date list of valid options.
|
||||
.TP
|
||||
The configuration file is not automatically created; you can create it using your favorite plain-text editor. By default, bitcoind(1) will look for a file named bitcoin.conf(5) in the bitcoin data directory, but both the data directory and the configuration file path may be changed using the '\-datadir' and '\-conf' command-line arguments.
|
||||
.SH LOCATION
|
||||
bitcoin.conf should be located in $HOME/.bitcoin
|
||||
.SH NETWORK-RELATED SETTINGS
|
||||
.TP
|
||||
.TP
|
||||
\fBtestnet=\fR[\fI'1'\fR|\fI'0'\fR]
|
||||
Enable or disable run on the test network instead of the real *bitcoin* network.
|
||||
.TP
|
||||
\fBproxy=\fR\fI'127.0.0.1:9050'\fR
|
||||
Connect via a socks4 proxy.
|
||||
.TP
|
||||
\fBaddnode=\fR\fI'10.0.0.2:8333'\fR
|
||||
Use as many *addnode=* settings as you like to connect to specific peers.
|
||||
.TP
|
||||
\fBconnect=\fR\fI'10.0.0.1:8333'\fR
|
||||
Use as many *connect=* settings as you like to connect ONLY to specific peers.
|
||||
.TP
|
||||
\fRmaxconnections=\fR\fI'value'\fR
|
||||
Maximum number of inbound+outbound connections.
|
||||
.SH JSON-RPC OPTIONS
|
||||
.TP
|
||||
\fBserver=\fR[\fI'1'\fR|\fI'0'\fR]
|
||||
Tells *bitcoin* to accept or not accept JSON-RPC commands.
|
||||
.TP
|
||||
\fBrpcuser=\fR\fI'username'\fR
|
||||
You must set *rpcuser* to secure the JSON-RPC api.
|
||||
.TP
|
||||
\fBrpcpassword=\fR\fI'password'\fR
|
||||
You must set *rpcpassword* to secure the JSON-RPC api.
|
||||
.TP
|
||||
\fBrpcallowip=\fR\fI'192.168.1.*'\fR
|
||||
By default, only RPC connections from localhost are allowed. Specify as many *rpcallowip=* settings as you like to allow connections from other hosts (and you may use * as a wildcard character).
|
||||
.TP
|
||||
\fBrpcport=\fR\fI'8332'\fR
|
||||
Listen for RPC connections on this TCP port.
|
||||
.TP
|
||||
\fBrpcconnect=\fR\fI'127.0.0.1'\fR
|
||||
You can use *bitcoin* or *bitcoind(1)* to send commands to *bitcoin*/*bitcoind(1)* running on another host using this option.
|
||||
.TP
|
||||
.SH MISCELLANEOUS OPTIONS
|
||||
.TP
|
||||
\fBgen=\fR[\fI'0'\fR|\fI'1'\fR]
|
||||
Enable or disable attempt to generate bitcoins.
|
||||
.TP
|
||||
\fB4way=\fR[\fI'0'\fR|\fI'1'\fR]
|
||||
Enable or disable use SSE instructions to try to generate bitcoins faster.
|
||||
.TP
|
||||
\fBkeypool=\fR\fI'100'\fR
|
||||
Pre-generate this many public/private key pairs, so wallet backups will be valid for both prior transactions and several dozen future transactions.
|
||||
.TP
|
||||
\fBpaytxfee=\fR\fI'0.00'\fR
|
||||
Pay an optional transaction fee every time you send bitcoins. Transactions with fees are more likely than free transactions to be included in generated blocks, so may be validated sooner.
|
||||
.TP
|
||||
\fBallowreceivebyip=\fR\fI'1'\fR
|
||||
Allow direct connections for the 'pay via IP address' feature.
|
||||
.TP
|
||||
.SH USER INTERFACE OPTIONS
|
||||
.TP
|
||||
\fBmin=\fR[\fI'0'\fR|\fI'1'\fR]
|
||||
Enable or disable start bitcoind minimized.
|
||||
.TP
|
||||
\fBminimizetotray=\fR[\fI'0'\fR|\fI'1'\fR]
|
||||
Enable or disable minimize to the system tray.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
bitcoind(1)
|
||||
.SH AUTHOR
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH BITCOIND "1" "January 2011" "bitcoind 3.19"
|
||||
.TH BITCOIND "1" "February 2016" "bitcoind 0.12"
|
||||
.SH NAME
|
||||
bitcoind \- peer-to-peer network based digital currency
|
||||
.SH SYNOPSIS
|
||||
@@ -6,185 +6,20 @@ bitcoin [options] <command> [params]
|
||||
.TP
|
||||
bitcoin [options] help <command> \- Get help for a command
|
||||
.SH DESCRIPTION
|
||||
This manual page documents the bitcoind program. Bitcoin is a peer-to-peer digital currency. Peer-to-peer (P2P) means that there is no central authority to issue new money or keep track of transactions. Instead, these tasks are managed collectively by the nodes of the network. Advantages:
|
||||
|
||||
Bitcoins can be sent easily through the Internet, without having to trust middlemen. Transactions are designed to be irreversible. Be safe from instability caused by fractional reserve banking and central banks. The limited inflation of the Bitcoin system’s money supply is distributed evenly (by CPU power) throughout the network, not monopolized by banks.
|
||||
This manual page documents the bitcoind program. Bitcoin is an experimental new digital currency that enables instant payments to anyone, anywhere in the world. Bitcoin uses peer-to-peer technology to operate with no central authority: managing transactions and issuing money are carried out collectively by the network. Bitcoin Core is the name of open source software which enables the use of this currency.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-conf=\fR<file>
|
||||
Specify configuration file (default: bitcoin.conf)
|
||||
.TP
|
||||
\fB\-gen\fR
|
||||
Generate coins
|
||||
.TP
|
||||
\fB\-gen\fR=\fI0\fR
|
||||
Don't generate coins
|
||||
.TP
|
||||
\fB\-min\fR
|
||||
Start minimized
|
||||
.TP
|
||||
\fB\-datadir=\fR<dir>
|
||||
Specify data directory
|
||||
.TP
|
||||
\fB\-proxy=\fR<ip:port>
|
||||
Connect through SOCKS5 proxy
|
||||
.TP
|
||||
\fB\-addnode=\fR<ip>
|
||||
Add a node to connect to
|
||||
.TP
|
||||
\fB\-connect=\fR<ip>
|
||||
Connect only to the specified node
|
||||
.TP
|
||||
\fB\-paytxfee=\fR<amt>
|
||||
Fee per KB to add to transactions you send
|
||||
.TP
|
||||
\fB\-server\fR
|
||||
Accept command line and JSON\-RPC commands
|
||||
.TP
|
||||
\fB\-daemon\fR
|
||||
Run in the background as a daemon and accept commands
|
||||
.TP
|
||||
\fB\-testnet\fR
|
||||
Use the test network
|
||||
.TP
|
||||
\fB\-rpcuser=\fR<user>
|
||||
Username for JSON\-RPC connections
|
||||
.TP
|
||||
\fB\-rpcpassword=\fR<pw>
|
||||
Password for JSON\-RPC connections
|
||||
.TP
|
||||
\fB\-rpcport=\fR<port>
|
||||
Listen for JSON\-RPC connections on <port>
|
||||
.TP
|
||||
\fB\-rpcallowip=\fR<ip>
|
||||
Allow JSON\-RPC connections from specified IP address
|
||||
.TP
|
||||
\fB\-rpcconnect=\fR<ip>
|
||||
Send commands to node running on <ip>
|
||||
.TP
|
||||
\-?
|
||||
This help message
|
||||
List of possible options.
|
||||
.SH COMMANDS
|
||||
.TP
|
||||
\fBbackupwallet 'destination'\fR
|
||||
Safely copies *wallet.dat* to 'destination', which can be a directory or a path with filename.
|
||||
.TP
|
||||
\fBgetaccount 'bitcoinaddress'\fR
|
||||
DEPRECATED. Returns the account associated with the given address.
|
||||
.TP
|
||||
\fBsetaccount 'bitcoinaddress' ['account']\fR
|
||||
DEPRECATED. Sets the ['account'] associated with the given address. ['account'] may be omitted to remove an address from ['account'].
|
||||
.TP
|
||||
\fBgetaccountaddress 'account'\fR
|
||||
DEPRECATED. Returns a new bitcoin address for 'account'.
|
||||
.TP
|
||||
\fBgetaddressesbyaccount 'account'\fR
|
||||
DEPRECATED. Returns the list of addresses associated with the given 'account'.
|
||||
.TP
|
||||
\fBgetbalance 'account'\fR
|
||||
Returns the server's available balance, or the balance for 'account' (accounts are deprecated).
|
||||
.TP
|
||||
\fBgetblockcount\fR
|
||||
Returns the number of blocks in the longest block chain.
|
||||
.TP
|
||||
\fBgetblocknumber\fR
|
||||
Returns the block number of the latest block in the longest block chain.
|
||||
.TP
|
||||
\fBgetconnectioncount\fR
|
||||
Returns the number of connections to other nodes.
|
||||
.TP
|
||||
\fBgetdifficulty\fR
|
||||
Returns the proof-of-work difficulty as a multiple of the minimum difficulty.
|
||||
.TP
|
||||
\fBgetgenerate\fR
|
||||
Returns boolean true if server is trying to generate bitcoins, false otherwise.
|
||||
.TP
|
||||
\fBsetgenerate 'generate' ['genproclimit']\fR
|
||||
Generation is limited to ['genproclimit'] processors, \-1 is unlimited.
|
||||
.TP
|
||||
\fBgethashespersec\fR
|
||||
Returns a recent hashes per second performance measurement while generating.
|
||||
.TP
|
||||
\fBgetinfo\fR
|
||||
Returns an object containing server information.
|
||||
.TP
|
||||
\fBgetnewaddress 'account'\fR
|
||||
Returns a new bitcoin address for receiving payments. If 'account' is specified (deprecated), it is added to the address book so payments received with the address will be credited to 'account'.
|
||||
.TP
|
||||
\fBgetreceivedbyaccount 'account' ['minconf=1']\fR
|
||||
DEPRECATED. Returns the total amount received by addresses associated with 'account' in transactions with at least ['minconf'] confirmations.
|
||||
.TP
|
||||
\fBgetreceivedbyaddress 'bitcoinaddress' ['minconf=1']\fR
|
||||
Returns the total amount received by 'bitcoinaddress' in transactions with at least ['minconf'] confirmations.
|
||||
.TP
|
||||
\fBgettransaction 'txid'\fR
|
||||
Returns information about a specific transaction, given hexadecimal transaction ID.
|
||||
.TP
|
||||
\fBgetwork 'data'\fR
|
||||
If 'data' is specified, tries to solve the block and returns true if it was successful. If 'data' is not specified, returns formatted hash 'data' to work on:
|
||||
\fBhelp\fR
|
||||
List commands.
|
||||
|
||||
"midstate" : precomputed hash state after hashing the first half of the data.
|
||||
"data" : block data.
|
||||
"hash1" : formatted hash buffer for second hash.
|
||||
"target" : little endian hash target.
|
||||
.TP
|
||||
\fBhelp 'command'\fR
|
||||
List commands, or get help for a command.
|
||||
.TP
|
||||
\fBlistaccounts ['minconf=1']\fR
|
||||
DEPRECATED. List accounts and their current balances.
|
||||
*note: requires bitcoin 0.3.20 or later.
|
||||
.TP
|
||||
\fBlistreceivedbyaccount ['minconf=1'] ['includeempty=false']\fR
|
||||
['minconf'] is the minimum number of confirmations before payments are included. ['includeempty'] whether to include addresses that haven't received any payments. Returns an array of objects containing:
|
||||
|
||||
"account" : DEPRECATED. the account of the receiving address.
|
||||
"amount" : total amount received by the address.
|
||||
"confirmations" : number of confirmations of the most recent transaction included.
|
||||
.TP
|
||||
\fBlistreceivedbyaddress ['minconf=1'] ['includeempty=false']\fR
|
||||
['minconf'] is the minimum number of confirmations before payments are included. ['includeempty'] whether to include addresses that haven't received any payments. Returns an array of objects containing:
|
||||
|
||||
"address" : receiving address.
|
||||
"account" : DEPRECATED. the account of the receiving address.
|
||||
"amount" : total amount received by the address.
|
||||
"confirmations" : number of confirmations of the most recent transaction included.
|
||||
.TP
|
||||
\fBlisttransactions 'account' ['count=10']\fR
|
||||
Returns a list of the last ['count'] transactions for 'account' \- for all accounts if 'account' is not specified or is "*". Each entry in the list may contain:
|
||||
|
||||
"category" : will be generate, send, receive, or move.
|
||||
"amount" : amount of transaction.
|
||||
"fee" : Fee (if any) paid (only for send transactions).
|
||||
"confirmations" : number of confirmations (only for generate/send/receive).
|
||||
"txid" : transaction ID (only for generate/send/receive).
|
||||
"otheraccount" : account funds were moved to or from (only for move).
|
||||
"message" : message associated with transaction (only for send).
|
||||
"to" : message-to associated with transaction (only for send).
|
||||
|
||||
*note: requires bitcoin 0.3.20 or later.
|
||||
.TP
|
||||
\fBmove <'fromaccount'> <'toaccount'> <'amount'> ['minconf=1'] ['comment']\fR
|
||||
DEPRECATED. Moves funds between accounts.
|
||||
.TP
|
||||
\fBsendfrom* <'account'> <'bitcoinaddress'> <'amount'> ['minconf=1'] ['comment'] ['comment-to']\fR
|
||||
DEPRECATED. Sends amount from account's balance to 'bitcoinaddress'. This method will fail if there is less than amount bitcoins with ['minconf'] confirmations in the account's balance (unless account is the empty-string-named default account; it behaves like the *sendtoaddress* method). Returns transaction ID on success.
|
||||
.TP
|
||||
\fBsendtoaddress 'bitcoinaddress' 'amount' ['comment'] ['comment-to']\fR
|
||||
Sends amount from the server's available balance to 'bitcoinaddress'. amount is a real and is rounded to the nearest 0.01. Returns transaction id on success.
|
||||
.TP
|
||||
\fBstop\fR
|
||||
Stops the bitcoin server.
|
||||
.TP
|
||||
\fBvalidateaddress 'bitcoinaddress'\fR
|
||||
Checks that 'bitcoinaddress' looks like a proper bitcoin address. Returns an object containing:
|
||||
|
||||
"isvalid" : true or false.
|
||||
"ismine" : true if the address is in the server's wallet.
|
||||
"address" : bitcoinaddress.
|
||||
|
||||
*note: ismine and address are only returned if the address is valid.
|
||||
Get help for a command.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
bitcoin.conf(5)
|
||||
|
||||
@@ -11,16 +11,16 @@ fix-copyright-headers.py
|
||||
========================
|
||||
|
||||
Every year newly updated files need to have its copyright headers updated to reflect the current year.
|
||||
If you run this script from src/ it will automatically update the year on the copyright header for all
|
||||
.cpp and .h files if these have a git commit from the current year.
|
||||
If you run this script from the root folder it will automatically update the year on the copyright header for all
|
||||
source files if these have a git commit from the current year.
|
||||
|
||||
For example a file changed in 2014 (with 2014 being the current year):
|
||||
For example a file changed in 2015 (with 2015 being the current year):
|
||||
|
||||
```// Copyright (c) 2009-2013 The Bitcoin Core developers```
|
||||
|
||||
would be changed to:
|
||||
|
||||
```// Copyright (c) 2009-2014 The Bitcoin Core developers```
|
||||
```// Copyright (c) 2009-2015 The Bitcoin Core developers```
|
||||
|
||||
git-subtree-check.sh
|
||||
====================
|
||||
|
||||
@@ -1,53 +1,46 @@
|
||||
#!/usr/bin/env python
|
||||
'''
|
||||
Run this script inside of src/ and it will look for all the files
|
||||
that were changed this year that still have the last year in the
|
||||
copyright headers, and it will fix the headers on that file using
|
||||
a perl regex one liner.
|
||||
Run this script to update all the copyright headers of files
|
||||
that were changed this year.
|
||||
|
||||
For example: if it finds something like this and we're in 2014
|
||||
For example:
|
||||
|
||||
// Copyright (c) 2009-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2012 The Bitcoin Core developers
|
||||
|
||||
it will change it to
|
||||
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
|
||||
It will do this for all the files in the folder and its children.
|
||||
|
||||
Author: @gubatron
|
||||
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
'''
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
|
||||
year = time.gmtime()[0]
|
||||
last_year = year - 1
|
||||
command = "perl -pi -e 's/%s The Bitcoin/%s The Bitcoin/' %s"
|
||||
listFilesCommand = "find . | grep %s"
|
||||
CMD_GIT_DATE = 'git log --format=@%%at -1 %s | date +"%%Y" -u -f -'
|
||||
CMD_REGEX= "perl -pi -e 's/(20\d\d)(?:-20\d\d)? The Bitcoin/$1-%s The Bitcoin/' %s"
|
||||
REGEX_CURRENT= re.compile("%s The Bitcoin" % year)
|
||||
CMD_LIST_FILES= "find %s | grep %s"
|
||||
|
||||
extensions = [".cpp",".h"]
|
||||
FOLDERS = ["./qa", "./src"]
|
||||
EXTENSIONS = [".cpp",".h", ".py"]
|
||||
|
||||
def getLastGitModifiedDate(filePath):
|
||||
gitGetLastCommitDateCommand = "git log " + filePath +" | grep Date | head -n 1"
|
||||
p = os.popen(gitGetLastCommitDateCommand)
|
||||
result = ""
|
||||
for l in p:
|
||||
result = l
|
||||
break
|
||||
result = result.replace("\n","")
|
||||
return result
|
||||
def get_git_date(file_path):
|
||||
r = os.popen(CMD_GIT_DATE % file_path)
|
||||
for l in r:
|
||||
# Result is one line, so just return
|
||||
return l.replace("\n","")
|
||||
return ""
|
||||
|
||||
n=1
|
||||
for extension in extensions:
|
||||
foundFiles = os.popen(listFilesCommand % extension)
|
||||
for filePath in foundFiles:
|
||||
filePath = filePath[1:-1]
|
||||
if filePath.endswith(extension):
|
||||
filePath = os.getcwd() + filePath
|
||||
modifiedTime = getLastGitModifiedDate(filePath)
|
||||
if len(modifiedTime) > 0 and str(year) in modifiedTime:
|
||||
print n,"Last Git Modified: ", modifiedTime, " - ", filePath
|
||||
os.popen(command % (last_year,year,filePath))
|
||||
n = n + 1
|
||||
|
||||
|
||||
for folder in FOLDERS:
|
||||
for extension in EXTENSIONS:
|
||||
for file_path in os.popen(CMD_LIST_FILES % (folder, extension)):
|
||||
file_path = os.getcwd() + file_path[1:-1]
|
||||
if file_path.endswith(extension):
|
||||
git_date = get_git_date(file_path)
|
||||
if str(year) == git_date:
|
||||
# Only update if current year is not found
|
||||
if REGEX_CURRENT.search(open(file_path, "r").read()) is None:
|
||||
print n,"Last git edit", git_date, "-", file_path
|
||||
os.popen(CMD_REGEX % (year,file_path))
|
||||
n = n + 1
|
||||
|
||||
@@ -72,7 +72,7 @@ def sanitize_string(s):
|
||||
'''Sanitize string for printing'''
|
||||
return s.replace('\n',' ')
|
||||
|
||||
def check_format_specifiers(source, translation, errors):
|
||||
def check_format_specifiers(source, translation, errors, numerus):
|
||||
source_f = split_format_specifiers(find_format_specifiers(source))
|
||||
# assert that no source messages contain both Qt and strprintf format specifiers
|
||||
# if this fails, go change the source as this is hacky and confusing!
|
||||
@@ -80,10 +80,13 @@ def check_format_specifiers(source, translation, errors):
|
||||
try:
|
||||
translation_f = split_format_specifiers(find_format_specifiers(translation))
|
||||
except IndexError:
|
||||
errors.append("Parse error in translation '%s'" % sanitize_string(translation))
|
||||
errors.append("Parse error in translation for '%s': '%s'" % (sanitize_string(source), sanitize_string(translation)))
|
||||
return False
|
||||
else:
|
||||
if source_f != translation_f:
|
||||
if numerus and source_f == (set(), ['n']) and translation_f == (set(), []) and translation.find('%') == -1:
|
||||
# Allow numerus translations to omit %n specifier (usually when it only has one possible value)
|
||||
return True
|
||||
errors.append("Mismatch between '%s' and '%s'" % (sanitize_string(source), sanitize_string(translation)))
|
||||
return False
|
||||
return True
|
||||
@@ -150,7 +153,7 @@ def postprocess_translations(reduce_diff_hacks=False):
|
||||
if translation is None:
|
||||
continue
|
||||
errors = []
|
||||
valid = check_format_specifiers(source, translation, errors)
|
||||
valid = check_format_specifiers(source, translation, errors, numerus)
|
||||
|
||||
for error in errors:
|
||||
print('%s: %s' % (filename, error))
|
||||
|
||||
@@ -15,7 +15,9 @@ packages:
|
||||
- "faketime"
|
||||
- "bsdmainutils"
|
||||
- "binutils-gold"
|
||||
reference_datetime: "2015-06-01 00:00:00"
|
||||
- "ca-certificates"
|
||||
- "python"
|
||||
reference_datetime: "2016-01-01 00:00:00"
|
||||
remotes:
|
||||
- "url": "https://github.com/bitcoin/bitcoin.git"
|
||||
"dir": "bitcoin"
|
||||
|
||||
@@ -5,9 +5,8 @@ suites:
|
||||
architectures:
|
||||
- "amd64"
|
||||
packages:
|
||||
- "libc6:i386"
|
||||
- "faketime"
|
||||
reference_datetime: "2015-06-01 00:00:00"
|
||||
reference_datetime: "2016-01-01 00:00:00"
|
||||
remotes:
|
||||
- "url": "https://github.com/bitcoin/bitcoin-detached-sigs.git"
|
||||
"dir": "signature"
|
||||
|
||||
@@ -18,7 +18,9 @@ packages:
|
||||
- "libcap-dev"
|
||||
- "libz-dev"
|
||||
- "libbz2-dev"
|
||||
reference_datetime: "2015-06-01 00:00:00"
|
||||
- "ca-certificates"
|
||||
- "python"
|
||||
reference_datetime: "2016-01-01 00:00:00"
|
||||
remotes:
|
||||
- "url": "https://github.com/bitcoin/bitcoin.git"
|
||||
"dir": "bitcoin"
|
||||
|
||||
@@ -7,7 +7,7 @@ architectures:
|
||||
packages:
|
||||
- "libssl-dev"
|
||||
- "autoconf"
|
||||
reference_datetime: "2015-06-01 00:00:00"
|
||||
reference_datetime: "2016-01-01 00:00:00"
|
||||
remotes:
|
||||
- "url": "https://github.com/bitcoin/bitcoin-detached-sigs.git"
|
||||
"dir": "signature"
|
||||
|
||||
@@ -18,7 +18,9 @@ packages:
|
||||
- "g++-mingw-w64"
|
||||
- "nsis"
|
||||
- "zip"
|
||||
reference_datetime: "2015-06-01 00:00:00"
|
||||
- "ca-certificates"
|
||||
- "python"
|
||||
reference_datetime: "2016-01-01 00:00:00"
|
||||
remotes:
|
||||
- "url": "https://github.com/bitcoin/bitcoin.git"
|
||||
"dir": "bitcoin"
|
||||
|
||||
5
depends/config.guess
vendored
5
depends/config.guess
vendored
@@ -2,7 +2,7 @@
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright 1992-2015 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2015-10-21'
|
||||
timestamp='2015-11-19'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@@ -1393,6 +1393,9 @@ EOF
|
||||
x86_64:VMkernel:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-esx
|
||||
exit ;;
|
||||
amd64:Isilon\ OneFS:*:*)
|
||||
echo x86_64-unknown-onefs
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
cat >&2 <<EOF
|
||||
|
||||
8
depends/config.sub
vendored
8
depends/config.sub
vendored
@@ -2,7 +2,7 @@
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright 1992-2015 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2015-08-20'
|
||||
timestamp='2015-11-22'
|
||||
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@@ -53,8 +53,7 @@ timestamp='2015-08-20'
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION] CPU-MFR-OPSYS
|
||||
$0 [OPTION] ALIAS
|
||||
Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
|
||||
|
||||
Canonicalize a configuration name.
|
||||
|
||||
@@ -1399,7 +1398,8 @@ case $os in
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
|
||||
| -onefs* | -tirtos*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package=boost
|
||||
$(package)_version=1_58_0
|
||||
$(package)_download_path=http://sourceforge.net/projects/boost/files/boost/1.58.0
|
||||
$(package)_version=1_59_0
|
||||
$(package)_download_path=http://sourceforge.net/projects/boost/files/boost/1.59.0
|
||||
$(package)_file_name=$(package)_$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=fdfc204fc33ec79c99b9a74944c3e54bd78be4f7f15e260c0e2700a36dc7d3e5
|
||||
$(package)_sha256_hash=727a932322d94287b62abb1bd2d41723eec4356a7728909e38adb65ca25241ca
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts_release=variant=release
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package=miniupnpc
|
||||
$(package)_version=1.9.20151008
|
||||
$(package)_version=1.9.20151026
|
||||
$(package)_download_path=http://miniupnp.free.fr/files
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=e444ac3b587ce82709c4d0cfca1fe71f44f9fc433e9f946b12b9e1bfe667a633
|
||||
$(package)_sha256_hash=f3cf9a5a31588a917d4d9237e5bc50f84d00c5aa48e27ed50d9b88dfa6a25d47
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_build_opts=CC="$($(package)_cc)"
|
||||
$(package)_build_opts_darwin=OS=Darwin
|
||||
$(package)_build_opts_darwin=OS=Darwin LIBTOOL="$($(package)_libtool)"
|
||||
$(package)_build_opts_mingw32=-f Makefile.mingw
|
||||
$(package)_build_env+=CFLAGS="$($(package)_cflags) $($(package)_cppflags)" AR="$($(package)_ar)"
|
||||
endef
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package=native_ccache
|
||||
$(package)_version=3.2.3
|
||||
$(package)_version=3.2.4
|
||||
$(package)_download_path=http://samba.org/ftp/ccache
|
||||
$(package)_file_name=ccache-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=b07165d4949d107d17f2f84b90b52953617bf1abbf249d5cc20636f43337c98c
|
||||
$(package)_sha256_hash=ffeb967edb549e67da0bd5f44f729a2022de9fdde65dfd80d2a7204d7f75332e
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package=zeromq
|
||||
$(package)_version=4.0.4
|
||||
$(package)_version=4.0.7
|
||||
$(package)_download_path=http://download.zeromq.org
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=1ef71d46e94f33e27dd5a1661ed626cd39be4d2d6967792a275040e34457d399
|
||||
$(package)_sha256_hash=e00b2967e074990d0538361cc79084a0a92892df2c6e7585da34e4c61ee47b03
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--without-documentation --disable-shared
|
||||
|
||||
@@ -34,7 +34,7 @@ PROJECT_NAME = Bitcoin
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 0.11.99
|
||||
PROJECT_NUMBER = 0.12.0
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Bitcoin Core 0.11.99
|
||||
Bitcoin Core 0.12.0
|
||||
=====================
|
||||
|
||||
Setup
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Bitcoin Core 0.11.99
|
||||
Bitcoin Core 0.12.0
|
||||
=====================
|
||||
|
||||
Intro
|
||||
|
||||
@@ -18,4 +18,5 @@ BIPs that are implemented by Bitcoin Core (up-to-date up to **v0.12.0**):
|
||||
* [`BIP 66`](https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki): The strict DER rules and associated version 3 blocks have been implemented since **v0.10.0** ([PR #5713](https://github.com/bitcoin/bitcoin/pull/5713)).
|
||||
* [`BIP 70`](https://github.com/bitcoin/bips/blob/master/bip-0070.mediawiki) [`71`](https://github.com/bitcoin/bips/blob/master/bip-0071.mediawiki) [`72`](https://github.com/bitcoin/bips/blob/master/bip-0072.mediawiki): Payment Protocol support has been available in Bitcoin Core GUI since **v0.9.0** ([PR #5216](https://github.com/bitcoin/bitcoin/pull/5216)).
|
||||
* [`BIP 111`](https://github.com/bitcoin/bips/blob/master/bip-0111.mediawiki): `NODE_BLOOM` service bit added, but only enforced for peer versions `>=70011` as of **v0.12.0** ([PR #6579](https://github.com/bitcoin/bitcoin/pull/6579)).
|
||||
* [`BIP 125`](https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki): Opt-in full replace-by-fee signaling honoured in mempool and mining as of **v0.12.0** ([PR 6871](https://github.com/bitcoin/bitcoin/pull/6871)).
|
||||
* [`BIP 130`](https://github.com/bitcoin/bips/blob/master/bip-0130.mediawiki): direct headers announcement is negotiated with peer versions `>=70012` as of **v0.12.0** ([PR 6494](https://github.com/bitcoin/bitcoin/pull/6494)).
|
||||
|
||||
@@ -61,7 +61,7 @@ Dependency Build Instructions: Ubuntu & Debian
|
||||
----------------------------------------------
|
||||
Build requirements:
|
||||
|
||||
sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev libevent-dev bsdmainutils
|
||||
sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils
|
||||
|
||||
On at least Ubuntu 14.04+ and Debian 7+ there are generic names for the
|
||||
individual boost development packages, so the following can be used to only
|
||||
|
||||
@@ -259,15 +259,15 @@ adduser debian sudo
|
||||
Then set up LXC and the rest with the following, which is a complex jumble of settings and workarounds:
|
||||
|
||||
```bash
|
||||
# the version of lxc-start in Debian 7.4 needs to run as root, so make sure
|
||||
# the version of lxc-start in Debian needs to run as root, so make sure
|
||||
# that the build script can execute it without providing a password
|
||||
echo "%sudo ALL=NOPASSWD: /usr/bin/lxc-start" > /etc/sudoers.d/gitian-lxc
|
||||
# add cgroup for LXC
|
||||
echo "cgroup /sys/fs/cgroup cgroup defaults 0 0" >> /etc/fstab
|
||||
# make /etc/rc.local script that sets up bridge between guest and host
|
||||
echo '#!/bin/sh -e' > /etc/rc.local
|
||||
echo 'brctl addbr br0' >> /etc/rc.local
|
||||
echo 'ifconfig br0 10.0.3.2/24 up' >> /etc/rc.local
|
||||
echo 'iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE' >> /etc/rc.local
|
||||
echo 'echo 1 > /proc/sys/net/ipv4/ip_forward' >> /etc/rc.local
|
||||
echo 'exit 0' >> /etc/rc.local
|
||||
# make sure that USE_LXC is always set when logging in as debian,
|
||||
# and configure LXC IP addresses
|
||||
|
||||
@@ -1,10 +1,340 @@
|
||||
(note: this is a temporary file, to be added-to by anybody, and moved to
|
||||
release-notes at release time)
|
||||
Bitcoin Core version 0.12.0 is now available from:
|
||||
|
||||
<https://bitcoin.org/bin/bitcoin-core-0.12.0/>
|
||||
|
||||
This is a new major version release, bringing new features and other improvements.
|
||||
|
||||
Please report bugs using the issue tracker at github:
|
||||
|
||||
<https://github.com/bitcoin/bitcoin/issues>
|
||||
|
||||
Upgrading and downgrading
|
||||
=========================
|
||||
|
||||
How to Upgrade
|
||||
--------------
|
||||
|
||||
If you are running an older version, shut it down. Wait until it has completely
|
||||
shut down (which might take a few minutes for older versions), then run the
|
||||
installer (on Windows) or just copy over /Applications/Bitcoin-Qt (on Mac) or
|
||||
bitcoind/bitcoin-qt (on Linux).
|
||||
|
||||
Downgrade warning
|
||||
------------------
|
||||
|
||||
### Downgrade to a version < 0.10.0
|
||||
|
||||
Because release 0.10.0 and later makes use of headers-first synchronization and
|
||||
parallel block download (see further), the block files and databases are not
|
||||
backwards-compatible with pre-0.10 versions of Bitcoin Core or other software:
|
||||
|
||||
* Blocks will be stored on disk out of order (in the order they are
|
||||
received, really), which makes it incompatible with some tools or
|
||||
other programs. Reindexing using earlier versions will also not work
|
||||
anymore as a result of this.
|
||||
|
||||
* The block index database will now hold headers for which no block is
|
||||
stored on disk, which earlier versions won't support.
|
||||
|
||||
If you want to be able to downgrade smoothly, make a backup of your entire data
|
||||
directory. Without this your node will need start syncing (or importing from
|
||||
bootstrap.dat) anew afterwards. It is possible that the data from a completely
|
||||
synchronised 0.10 node may be usable in older versions as-is, but this is not
|
||||
supported and may break as soon as the older version attempts to reindex.
|
||||
|
||||
This does not affect wallet forward or backward compatibility.
|
||||
|
||||
### Downgrade to a version < 0.12.0
|
||||
|
||||
Because release 0.12.0 and later will obfuscate the chainstate on every
|
||||
fresh sync or reindex, the chainstate is not backwards-compatible with
|
||||
pre-0.12 versions of Bitcoin Core or other software.
|
||||
|
||||
If you want to downgrade after you have done a reindex with 0.12.0 or later,
|
||||
you will need to reindex when you first start Bitcoin Core version 0.11 or
|
||||
earlier.
|
||||
|
||||
Notable changes
|
||||
===============
|
||||
|
||||
SSL support for RPC dropped
|
||||
Signature validation using libsecp256k1
|
||||
---------------------------------------
|
||||
|
||||
ECDSA signatures inside Bitcoin transactions now use validation using
|
||||
[https://github.com/bitcoin/secp256k1](libsecp256k1) instead of OpenSSL.
|
||||
|
||||
Depending on the platform, this means a significant speedup for raw signature
|
||||
validation speed. The advantage is largest on x86_64, where validation is over
|
||||
five times faster. In practice, this translates to a raw reindexing and new
|
||||
block validation times that are less than half of what it was before.
|
||||
|
||||
Libsecp256k1 has undergone very extensive testing and validation.
|
||||
|
||||
A side effect of this change is that libconsensus no longer depends on OpenSSL.
|
||||
|
||||
Reduce upload traffic
|
||||
---------------------
|
||||
|
||||
A major part of the outbound traffic is caused by serving historic blocks to
|
||||
other nodes in initial block download state.
|
||||
|
||||
It is now possible to reduce the total upload traffic via the `-maxuploadtarget`
|
||||
parameter. This is *not* a hard limit but a threshold to minimize the outbound
|
||||
traffic. When the limit is about to be reached, the uploaded data is cut by not
|
||||
serving historic blocks (blocks older than one week).
|
||||
Moreover, any SPV peer is disconnected when they request a filtered block.
|
||||
|
||||
This option can be specified in MiB per day and is turned off by default
|
||||
(`-maxuploadtarget=0`).
|
||||
The recommended minimum is 144 * MAX_BLOCK_SIZE (currently 144MB) per day.
|
||||
|
||||
Whitelisted peers will never be disconnected, although their traffic counts for
|
||||
calculating the target.
|
||||
|
||||
A more detailed documentation about keeping traffic low can be found in
|
||||
[/doc/reduce-traffic.md](/doc/reduce-traffic.md).
|
||||
|
||||
Direct headers announcement (BIP 130)
|
||||
-------------------------------------
|
||||
|
||||
Between compatible peers, [BIP 130]
|
||||
(https://github.com/bitcoin/bips/blob/master/bip-0130.mediawiki)
|
||||
direct headers announcement is used. This means that blocks are advertized by
|
||||
announcing their headers directly, instead of just announcing the hash. In a
|
||||
reorganization, all new headers are sent, instead of just the new tip. This
|
||||
can often prevent an extra roundtrip before the actual block is downloaded.
|
||||
|
||||
Memory pool limiting
|
||||
--------------------
|
||||
|
||||
Previous versions of Bitcoin Core had their mempool limited by checking
|
||||
a transaction's fees against the node's minimum relay fee. There was no
|
||||
upper bound on the size of the mempool and attackers could send a large
|
||||
number of transactions paying just slighly more than the default minimum
|
||||
relay fee to crash nodes with relatively low RAM. A temporary workaround
|
||||
for previous versions of Bitcoin Core was to raise the default minimum
|
||||
relay fee.
|
||||
|
||||
Bitcoin Core 0.12 will have a strict maximum size on the mempool. The
|
||||
default value is 300 MB and can be configured with the `-maxmempool`
|
||||
parameter. Whenever a transaction would cause the mempool to exceed
|
||||
its maximum size, the transaction that (along with in-mempool descendants) has
|
||||
the lowest total feerate (as a package) will be evicted and the node's effective
|
||||
minimum relay feerate will be increased to match this feerate plus the initial
|
||||
minimum relay feerate. The initial minimum relay feerate is set to
|
||||
1000 satoshis per kB.
|
||||
|
||||
Bitcoin Core 0.12 also introduces new default policy limits on the length and
|
||||
size of unconfirmed transaction chains that are allowed in the mempool
|
||||
(generally limiting the length of unconfirmed chains to 25 transactions, with a
|
||||
total size of 101 KB). These limits can be overriden using command line
|
||||
arguments; see the extended help (`--help -help-debug`) for more information.
|
||||
|
||||
Replace-by-fee transactions
|
||||
---------------------------
|
||||
|
||||
It is now possible to replace transactions in the transaction memory pool of
|
||||
Bitcoin Core 0.12 nodes. Bitcoin Core will only replace transactions which
|
||||
have any of their inputs' `nSequence` number set to less than `0xffffffff - 1`.
|
||||
Moreover, a replacement transaction may only be accepted when it pays
|
||||
sufficient fee, as described in [BIP 125]
|
||||
(https://github.com/bitcoin/bips/blob/master/bip-0125.mediawiki).
|
||||
|
||||
RPC: Random-cookie RPC authentication
|
||||
---------------------------------------
|
||||
|
||||
When no `-rpcpassword` is specified, the daemon now uses a special 'cookie'
|
||||
file for authentication. This file is generated with random content when the
|
||||
daemon starts, and deleted when it exits. Its contents are used as
|
||||
authentication token. Read access to this file controls who can access through
|
||||
RPC. By default it is stored in the data directory but its location can be
|
||||
overridden with the option `-rpccookiefile`.
|
||||
|
||||
This is similar to Tor's CookieAuthentication: see
|
||||
https://www.torproject.org/docs/tor-manual.html.en
|
||||
|
||||
This allows running bitcoind without having to do any manual configuration.
|
||||
|
||||
Relay: Any sequence of pushdatas in OP_RETURN outputs now allowed
|
||||
-----------------------------------------------------------------
|
||||
|
||||
Previously OP_RETURN outputs with a payload were only relayed and mined if they
|
||||
had a single pushdata. This restriction has been lifted to allow any
|
||||
combination of data pushes and numeric constant opcodes (OP_1 to OP_16) after
|
||||
the OP_RETURN. The limit on OP_RETURN output size is now applied to the entire
|
||||
serialized scriptPubKey, 83 bytes by default. (the previous 80 byte default plus
|
||||
three bytes overhead)
|
||||
|
||||
Relay and Mining: Priority transactions
|
||||
---------------------------------------
|
||||
|
||||
Transactions that do not pay the minimum relay fee, are called "free
|
||||
transactions" or priority transactions. Previous versions of Bitcoin
|
||||
Core would relay and mine priority transactions depending on their
|
||||
setting of `-limitfreerelay=<r>` (default: `r=15` kB per minute) and
|
||||
`-blockprioritysize=<s>` (default: `50000` bytes of a block's
|
||||
priority space).
|
||||
|
||||
Priority code is scheduled for removal in Bitcoin Core 0.13. In
|
||||
Bitcoin Core 0.12, the default block priority size has been set to `0`
|
||||
and the priority calculation has been simplified to only include the
|
||||
coin age of inputs that were in the blockchain at the time the transaction
|
||||
was accepted into the mempool. In addition priority transactions are not
|
||||
accepted to the mempool if mempool limiting has triggered a higher effective
|
||||
minimum relay fee.
|
||||
|
||||
Automatically use Tor hidden services
|
||||
-------------------------------------
|
||||
|
||||
Starting with Tor version 0.2.7.1 it is possible, through Tor's control socket
|
||||
API, to create and destroy 'ephemeral' hidden services programmatically.
|
||||
Bitcoin Core has been updated to make use of this.
|
||||
|
||||
This means that if Tor is running (and proper authorization is available),
|
||||
Bitcoin Core automatically creates a hidden service to listen on, without
|
||||
manual configuration. Bitcoin Core will also use Tor automatically to connect
|
||||
to other .onion nodes if the control socket can be successfully opened. This
|
||||
will positively affect the number of available .onion nodes and their usage.
|
||||
|
||||
This new feature is enabled by default if Bitcoin Core is listening, and
|
||||
a connection to Tor can be made. It can be configured with the `-listenonion`,
|
||||
`-torcontrol` and `-torpassword` settings. To show verbose debugging
|
||||
information, pass `-debug=tor`.
|
||||
|
||||
Notifications through ZMQ
|
||||
-------------------------
|
||||
|
||||
Bitcoind can now (optionally) asynchronously notify clients through a
|
||||
ZMQ-based PUB socket of the arrival of new transactions and blocks.
|
||||
This feature requires installation of the ZMQ C API library 4.x and
|
||||
configuring its use through the command line or configuration file.
|
||||
Please see [docs/zmq.md](/doc/zmq.md) for details of operation.
|
||||
|
||||
Wallet: Transaction fees
|
||||
------------------------
|
||||
|
||||
Various improvements have been made to how the wallet calculates
|
||||
transaction fees.
|
||||
|
||||
Users can decide to pay a predefined fee rate by setting `-paytxfee=<n>`
|
||||
(or `settxfee <n>` rpc during runtime). A value of `n=0` signals Bitcoin
|
||||
Core to use floating fees. By default, Bitcoin Core will use floating
|
||||
fees.
|
||||
|
||||
Based on past transaction data, floating fees approximate the fees
|
||||
required to get into the `m`th block from now. This is configurable
|
||||
with `-txconfirmtarget=<m>` (default: `2`).
|
||||
|
||||
Sometimes, it is not possible to give good estimates, or an estimate
|
||||
at all. Therefore, a fallback value can be set with `-fallbackfee=<f>`
|
||||
(default: `0.0002` BTC/kB).
|
||||
|
||||
At all times, Bitcoin Core will cap fees at `-maxtxfee=<x>` (default:
|
||||
0.10) BTC.
|
||||
Furthermore, Bitcoin Core will never create transactions smaller than
|
||||
the current minimum relay fee.
|
||||
Finally, a user can set the minimum fee rate for all transactions with
|
||||
`-mintxfee=<i>`, which defaults to 1000 satoshis per kB.
|
||||
|
||||
Wallet: Negative confirmations and conflict detection
|
||||
-----------------------------------------------------
|
||||
|
||||
The wallet will now report a negative number for confirmations that indicates
|
||||
how deep in the block chain the conflict is found. For example, if a transaction
|
||||
A has 5 confirmations and spends the same input as a wallet transaction B, B
|
||||
will be reported as having -5 confirmations. If another wallet transaction C
|
||||
spends an output from B, it will also be reported as having -5 confirmations.
|
||||
To detect conflicts with historical transactions in the chain a one-time
|
||||
`-rescan` may be needed.
|
||||
|
||||
Unlike earlier versions, unconfirmed but non-conflicting transactions will never
|
||||
get a negative confirmation count. They are not treated as spendable unless
|
||||
they're coming from ourself (change) and accepted into our local mempool,
|
||||
however. The new "trusted" field in the `listtransactions` RPC output
|
||||
indicates whether outputs of an unconfirmed transaction are considered
|
||||
spendable.
|
||||
|
||||
Wallet: Merkle branches removed
|
||||
-------------------------------
|
||||
|
||||
Previously, every wallet transaction stored a Merkle branch to prove its
|
||||
presence in blocks. This wasn't being used for more than an expensive
|
||||
sanity check. Since 0.12, these are no longer stored. When loading a
|
||||
0.12 wallet into an older version, it will automatically rescan to avoid
|
||||
failed checks.
|
||||
|
||||
Wallet: Pruning
|
||||
---------------
|
||||
|
||||
With 0.12 it is possible to use wallet functionality in pruned mode.
|
||||
However, rescans as well as the RPCs `importwallet`, `importaddress`,
|
||||
`importprivkey` are disabled.
|
||||
|
||||
To enable block pruning set `prune=<N>` on the command line or in
|
||||
`bitcoin.conf`, where `N` is the number of MiB to allot for
|
||||
raw block & undo data.
|
||||
|
||||
`NODE_BLOOM` service bit
|
||||
------------------------
|
||||
|
||||
Support for the `NODE_BLOOM` service bit, as described in [BIP
|
||||
111](https://github.com/bitcoin/bips/blob/master/bip-0111.mediawiki), has been
|
||||
added to the P2P protocol code.
|
||||
|
||||
BIP 111 defines a service bit to allow peers to advertise that they support
|
||||
bloom filters (such as used by SPV clients) explicitly. It also bumps the protocol
|
||||
version to allow peers to identify old nodes which allow bloom filtering of the
|
||||
connection despite lacking the new service bit.
|
||||
|
||||
In this version, it is only enforced for peers that send protocol versions
|
||||
`>=70011`. For the next major version it is planned that this restriction will be
|
||||
removed. It is recommended to update SPV clients to check for the `NODE_BLOOM`
|
||||
service bit for nodes that report versions newer than 70011.
|
||||
|
||||
Option parsing behavior
|
||||
-----------------------
|
||||
|
||||
Command line options are now parsed strictly in the order in which they are
|
||||
specified. It used to be the case that `-X -noX` ends up, unintuitively, with X
|
||||
set, as `-X` had precedence over `-noX`. This is no longer the case. Like for
|
||||
other software, the last specified value for an option will hold.
|
||||
|
||||
RPC: Low-level API changes
|
||||
--------------------------
|
||||
|
||||
- Monetary amounts can be provided as strings. This means that for example the
|
||||
argument to sendtoaddress can be "0.0001" instead of 0.0001. This can be an
|
||||
advantage if a JSON library insists on using a lossy floating point type for
|
||||
numbers, which would be dangerous for monetary amounts.
|
||||
|
||||
* The `asm` property of each scriptSig now contains the decoded signature hash
|
||||
type for each signature that provides a valid defined hash type.
|
||||
|
||||
* OP_NOP2 has been renamed to OP_CHECKLOCKTIMEVERIFY by [BIP 65](https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki)
|
||||
|
||||
The following items contain assembly representations of scriptSig signatures
|
||||
and are affected by this change:
|
||||
|
||||
- RPC `getrawtransaction`
|
||||
- RPC `decoderawtransaction`
|
||||
- RPC `decodescript`
|
||||
- REST `/rest/tx/` (JSON format)
|
||||
- REST `/rest/block/` (JSON format when including extended tx details)
|
||||
- `bitcoin-tx -json`
|
||||
|
||||
For example, the `scriptSig.asm` property of a transaction input that
|
||||
previously showed an assembly representation of:
|
||||
|
||||
304502207fa7a6d1e0ee81132a269ad84e68d695483745cde8b541e3bf630749894e342a022100c1f7ab20e13e22fb95281a870f3dcf38d782e53023ee313d741ad0cfbc0c509001 400000 OP_NOP2
|
||||
|
||||
now shows as:
|
||||
|
||||
304502207fa7a6d1e0ee81132a269ad84e68d695483745cde8b541e3bf630749894e342a022100c1f7ab20e13e22fb95281a870f3dcf38d782e53023ee313d741ad0cfbc0c5090[ALL] 400000 OP_CHECKLOCKTIMEVERIFY
|
||||
|
||||
Note that the output of the RPC `decodescript` did not change because it is
|
||||
configured specifically to process scriptPubKey and not scriptSig scripts.
|
||||
|
||||
RPC: SSL support dropped
|
||||
----------------------------
|
||||
|
||||
SSL support for RPC, previously enabled by the option `rpcssl` has been dropped
|
||||
@@ -57,181 +387,14 @@ caching. A sample config for apache2 could look like:
|
||||
|
||||
</VirtualHost>
|
||||
|
||||
Random-cookie RPC authentication
|
||||
---------------------------------
|
||||
Mining Code Changes
|
||||
-------------------
|
||||
|
||||
When no `-rpcpassword` is specified, the daemon now uses a special 'cookie'
|
||||
file for authentication. This file is generated with random content when the
|
||||
daemon starts, and deleted when it exits. Its contents are used as
|
||||
authentication token. Read access to this file controls who can access through
|
||||
RPC. By default it is stored in the data directory but its location can be
|
||||
overridden with the option `-rpccookiefile`.
|
||||
|
||||
This is similar to Tor's CookieAuthentication: see
|
||||
https://www.torproject.org/docs/tor-manual.html.en
|
||||
|
||||
This allows running bitcoind without having to do any manual configuration.
|
||||
|
||||
Low-level RPC API changes
|
||||
--------------------------
|
||||
|
||||
- Monetary amounts can be provided as strings. This means that for example the
|
||||
argument to sendtoaddress can be "0.0001" instead of 0.0001. This can be an
|
||||
advantage if a JSON library insists on using a lossy floating point type for
|
||||
numbers, which would be dangerous for monetary amounts.
|
||||
|
||||
Option parsing behavior
|
||||
-----------------------
|
||||
|
||||
Command line options are now parsed strictly in the order in which they are
|
||||
specified. It used to be the case that `-X -noX` ends up, unintuitively, with X
|
||||
set, as `-X` had precedence over `-noX`. This is no longer the case. Like for
|
||||
other software, the last specified value for an option will hold.
|
||||
|
||||
`NODE_BLOOM` service bit
|
||||
------------------------
|
||||
|
||||
Support for the `NODE_BLOOM` service bit, as described in [BIP
|
||||
111](https://github.com/bitcoin/bips/blob/master/bip-0111.mediawiki), has been
|
||||
added to the P2P protocol code.
|
||||
|
||||
BIP 111 defines a service bit to allow peers to advertise that they support
|
||||
bloom filters (such as used by SPV clients) explicitly. It also bumps the protocol
|
||||
version to allow peers to identify old nodes which allow bloom filtering of the
|
||||
connection despite lacking the new service bit.
|
||||
|
||||
In this version, it is only enforced for peers that send protocol versions
|
||||
`>=70011`. For the next major version it is planned that this restriction will be
|
||||
removed. It is recommended to update SPV clients to check for the `NODE_BLOOM`
|
||||
service bit for nodes that report versions newer than 70011.
|
||||
|
||||
Any sequence of pushdatas in OP_RETURN outputs now allowed
|
||||
----------------------------------------------------------
|
||||
|
||||
Previously OP_RETURN outputs with a payload were only relayed and mined if they
|
||||
had a single pushdata. This restriction has been lifted to allow any
|
||||
combination of data pushes and numeric constant opcodes (OP_1 to OP_16). The
|
||||
limit on OP_RETURN output size is now applied to the entire serialized
|
||||
scriptPubKey, 83 bytes by default. (the previous 80 byte default plus three
|
||||
bytes overhead)
|
||||
|
||||
Merkle branches removed from wallet
|
||||
-----------------------------------
|
||||
|
||||
Previously, every wallet transaction stored a Merkle branch to prove its
|
||||
presence in blocks. This wasn't being used for more than an expensive
|
||||
sanity check. Since 0.12, these are no longer stored. When loading a
|
||||
0.12 wallet into an older version, it will automatically rescan to avoid
|
||||
failed checks.
|
||||
|
||||
BIP65 - CHECKLOCKTIMEVERIFY
|
||||
---------------------------
|
||||
|
||||
Previously it was impossible to create a transaction output that was guaranteed
|
||||
to be unspendable until a specific date in the future. CHECKLOCKTIMEVERIFY is a
|
||||
new opcode that allows a script to check if a specific block height or time has
|
||||
been reached, failing the script otherwise. This enables a wide variety of new
|
||||
functionality such as time-locked escrows, secure payment channels, etc.
|
||||
|
||||
BIP65 implements CHECKLOCKTIMEVERIFY by introducing block version 4, which adds
|
||||
additional restrictions to the NOP2 opcode. The same miner-voting mechanism as
|
||||
in BIP34 and BIP66 is used: when 751 out of a sequence of 1001 blocks have
|
||||
version number 4 or higher, the new consensus rule becomes active for those
|
||||
blocks. When 951 out of a sequence of 1001 blocks have version number 4 or
|
||||
higher, it becomes mandatory for all blocks and blocks with versions less than
|
||||
4 are rejected.
|
||||
|
||||
Bitcoin Core's block templates are now for version 4 blocks only, and any
|
||||
mining software relying on its `getblocktemplate` must be updated in parallel
|
||||
to use either libblkmaker version 0.4.3 or any version from 0.5.2 onward. If
|
||||
you are solo mining, this will affect you the moment you upgrade Bitcoin Core,
|
||||
which must be done prior to BIP65 achieving its 951/1001 status. If you are
|
||||
mining with the stratum mining protocol: this does not affect you. If you are
|
||||
mining with the getblocktemplate protocol to a pool: this will affect you at
|
||||
the pool operator's discretion, which must be no later than BIP65 achieving its
|
||||
951/1001 status.
|
||||
|
||||
Automatically use Tor hidden services
|
||||
-------------------------------------
|
||||
|
||||
Starting with Tor version 0.2.7.1 it is possible, through Tor's control socket
|
||||
API, to create and destroy 'ephemeral' hidden services programmatically.
|
||||
Bitcoin Core has been updated to make use of this.
|
||||
|
||||
This means that if Tor is running (and proper authorization is available),
|
||||
Bitcoin Core automatically creates a hidden service to listen on, without
|
||||
manual configuration. Bitcoin Core will also use Tor automatically to connect
|
||||
to other .onion nodes if the control socket can be successfully opened. This
|
||||
will positively affect the number of available .onion nodes and their usage.
|
||||
|
||||
This new feature is enabled by default if Bitcoin Core is listening, and
|
||||
a connection to Tor can be made. It can be configured with the `-listenonion`,
|
||||
`-torcontrol` and `-torpassword` settings. To show verbose debugging
|
||||
information, pass `-debug=tor`.
|
||||
|
||||
Reduce upload traffic
|
||||
---------------------
|
||||
|
||||
A major part of the outbound traffic is caused by serving historic blocks to
|
||||
other nodes in initial block download state.
|
||||
|
||||
It is now possible to reduce the total upload traffic via the `-maxuploadtarget`
|
||||
parameter. This is *not* a hard limit but a threshold to minimize the outbound
|
||||
traffic. When the limit is about to be reached, the uploaded data is cut by not
|
||||
serving historic blocks (blocks older than one week).
|
||||
Moreover, any SPV peer is disconnected when they request a filtered block.
|
||||
|
||||
This option can be specified in MiB per day and is turned off by default
|
||||
(`-maxuploadtarget=0`).
|
||||
The recommended minimum is 144 * MAX_BLOCK_SIZE (currently 144MB) per day.
|
||||
|
||||
Whitelisted peers will never be disconnected, although their traffic counts for
|
||||
calculating the target.
|
||||
|
||||
A more detailed documentation about keeping traffic low can be found in
|
||||
[/doc/reducetraffic.md](/doc/reducetraffic.md).
|
||||
|
||||
Signature validation using libsecp256k1
|
||||
---------------------------------------
|
||||
|
||||
ECDSA signatures inside Bitcoin transactions now use validation using
|
||||
[https://github.com/bitcoin/secp256k1](libsecp256k1) instead of OpenSSL.
|
||||
|
||||
Depending on the platform, this means a significant speedup for raw signature
|
||||
validation speed. The advantage is largest on x86_64, where validation is over
|
||||
five times faster. In practice, this translates to a raw reindexing and new
|
||||
block validation times that are less than half of what it was before.
|
||||
|
||||
Libsecp256k1 has undergone very extensive testing and validation.
|
||||
|
||||
A side effect of this change is that libconsensus no longer depends on OpenSSL.
|
||||
|
||||
Direct headers announcement (BIP 130)
|
||||
-------------------------------------
|
||||
|
||||
Between compatible peers, BIP 130 direct headers announcement is used. This
|
||||
means that blocks are advertized by announcing their headers directly, instead
|
||||
of just announcing the hash. In a reorganization, all new headers are sent,
|
||||
instead of just the new tip. This can often prevent an extra roundtrip before
|
||||
the actual block is downloaded.
|
||||
|
||||
Negative confirmations and conflict detection
|
||||
---------------------------------------------
|
||||
|
||||
The wallet will now report a negative number for confirmations that indicates
|
||||
how deep in the block chain the conflict is found. For example, if a transaction
|
||||
A has 5 confirmations and spends the same input as a wallet transaction B, B
|
||||
will be reported as having -5 confirmations. If another wallet transaction C
|
||||
spends an output from B, it will also be reported as having -5 confirmations.
|
||||
To detect conflicts with historical transactions in the chain a one-time
|
||||
`-rescan` may be needed.
|
||||
|
||||
Unlike earlier versions, unconfirmed but non-conflicting transactions will never
|
||||
get a negative confirmation count. They are not treated as spendable unless
|
||||
they're coming from ourself (change) and accepted into our local mempool,
|
||||
however. The new "trusted" field in the `listtransactions` RPC output
|
||||
indicates whether outputs of an unconfirmed transaction are considered
|
||||
spendable.
|
||||
The mining code in 0.12 has been optimized to be significantly faster and use less
|
||||
memory. As part of these changes, consensus critical calculations are cached on a
|
||||
transaction's acceptance into the mempool and the mining code now relies on the
|
||||
consistency of the mempool to assemble blocks. However all blocks are still tested
|
||||
for validity after assembly.
|
||||
|
||||
0.12.0 Change log
|
||||
=================
|
||||
@@ -243,58 +406,409 @@ git merge commit are mentioned.
|
||||
|
||||
### RPC and REST
|
||||
|
||||
Asm representations of scriptSig signatures now contain SIGHASH type decodes
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
The `asm` property of each scriptSig now contains the decoded signature hash
|
||||
type for each signature that provides a valid defined hash type.
|
||||
|
||||
The following items contain assembly representations of scriptSig signatures
|
||||
and are affected by this change:
|
||||
|
||||
- RPC `getrawtransaction`
|
||||
- RPC `decoderawtransaction`
|
||||
- REST `/rest/tx/` (JSON format)
|
||||
- REST `/rest/block/` (JSON format when including extended tx details)
|
||||
- `bitcoin-tx -json`
|
||||
|
||||
For example, the `scriptSig.asm` property of a transaction input that
|
||||
previously showed an assembly representation of:
|
||||
|
||||
304502207fa7a6d1e0ee81132a269ad84e68d695483745cde8b541e3bf630749894e342a022100c1f7ab20e13e22fb95281a870f3dcf38d782e53023ee313d741ad0cfbc0c509001
|
||||
|
||||
now shows as:
|
||||
|
||||
304502207fa7a6d1e0ee81132a269ad84e68d695483745cde8b541e3bf630749894e342a022100c1f7ab20e13e22fb95281a870f3dcf38d782e53023ee313d741ad0cfbc0c5090[ALL]
|
||||
|
||||
Note that the output of the RPC `decodescript` did not change because it is
|
||||
configured specifically to process scriptPubKey and not scriptSig scripts.
|
||||
- #6121 `466f0ea` Convert entire source tree from json_spirit to UniValue
|
||||
- #6234 `d38cd47` fix rpcmining/getblocktemplate univalue transition logic error
|
||||
- #6239 `643114f` Don't go through double in AmountFromValue and ValueFromAmount
|
||||
- #6266 `ebab5d3` Fix univalue handling of \u0000 characters.
|
||||
- #6276 `f3d4dbb` Fix getbalance * 0
|
||||
- #6257 `5ebe7db` Add `paytxfee` and `errors` JSON fields where appropriate
|
||||
- #6271 `754aae5` New RPC command disconnectnode
|
||||
- #6158 `0abfa8a` Add setban/listbanned RPC commands
|
||||
- #6307 `7ecdcd9` rpcban fixes
|
||||
- #6290 `5753988` rpc: make `gettxoutsettinfo` run lock-free
|
||||
- #6262 `247b914` Return all available information via RPC call "validateaddress"
|
||||
- #6339 `c3f0490` UniValue: don't escape solidus, keep espacing of reverse solidus
|
||||
- #6353 `6bcb0a2` Show softfork status in getblockchaininfo
|
||||
- #6247 `726e286` Add getblockheader RPC call
|
||||
- #6362 `d6db115` Fix null id in RPC response during startup
|
||||
- #5486 `943b322` [REST] JSON support for /rest/headers
|
||||
- #6379 `c52e8b3` rpc: Accept scientific notation for monetary amounts in JSON
|
||||
- #6388 `fd5dfda` rpc: Implement random-cookie based authentication
|
||||
- #6457 `3c923e8` Include pruned state in chaininfo.json
|
||||
- #6456 `bfd807f` rpc: Avoid unnecessary parsing roundtrip in number formatting, fix locale issue
|
||||
- #6380 `240b30e` rpc: Accept strings in AmountFromValue
|
||||
- #6346 `6bb2805` Add OP_RETURN support in createrawtransaction RPC call, add tests.
|
||||
- #6013 `6feeec1` [REST] Add memory pool API
|
||||
- #6576 `da9beb2` Stop parsing JSON after first finished construct.
|
||||
- #5677 `9aa9099` libevent-based http server
|
||||
- #6633 `bbc2b39` Report minimum ping time in getpeerinfo
|
||||
- #6648 `cd381d7` Simplify logic of REST request suffix parsing.
|
||||
- #6695 `5e21388` libevent http fixes
|
||||
- #5264 `48efbdb` show scriptSig signature hash types in transaction decodes. fixes #3166
|
||||
- #6719 `1a9f19a` Make HTTP server shutdown more graceful
|
||||
- #6859 `0fbfc51` http: Restrict maximum size of http + headers
|
||||
- #5936 `bf7c195` [RPC] Add optional locktime to createrawtransaction
|
||||
- #6877 `26f5b34` rpc: Add maxmempool and effective min fee to getmempoolinfo
|
||||
- #6970 `92701b3` Fix crash in validateaddress with -disablewallet
|
||||
- #5574 `755b4ba` Expose GUI labels in RPC as comments
|
||||
- #6990 `dbd2c13` http: speed up shutdown
|
||||
- #7013 `36baa9f` Remove LOCK(cs_main) from decodescript
|
||||
- #6999 `972bf9c` add (max)uploadtarget infos to getnettotals RPC help
|
||||
- #7011 `31de241` Add mediantime to getblockchaininfo
|
||||
- #7065 `f91e29f` http: add Boost 1.49 compatibility
|
||||
- #7087 `be281d8` [Net]Add -enforcenodebloom option
|
||||
- #7044 `438ee59` RPC: Added additional config option for multiple RPC users.
|
||||
- #7072 `c143c49` [RPC] Add transaction size to JSON output
|
||||
- #7022 `9afbd96` Change default block priority size to 0
|
||||
- #7141 `c0c08c7` rpc: Don't translate warning messages
|
||||
- #7312 `fd4bd50` Add RPC call abandontransaction
|
||||
|
||||
### Configuration and command-line options
|
||||
|
||||
- #6164 `8d05ec7` Allow user to use -debug=1 to enable all debugging
|
||||
- #5288 `4452205` Added -whiteconnections=<n> option
|
||||
- #6284 `10ac38e` Fix argument parsing oddity with -noX
|
||||
- #6489 `c9c017a` Give a better error message if system clock is bad
|
||||
- #6462 `c384800` implement uacomment config parameter which can add comments to user agent as per BIP-0014
|
||||
- #6647 `a3babc8` Sanitize uacomment
|
||||
- #6742 `3b2d37c` Changed logging to make -logtimestamps to work also for -printtoconsole #6742
|
||||
- #6846 `2cd020d` alias -h for -help
|
||||
- #6622 `7939164` Introduce -maxuploadtarget
|
||||
- #6881 `2b62551` Debug: Add option for microsecond precision in debug.log
|
||||
- #6776 `e06c14f` Support -checkmempool=N, which runs checks once every N transactions
|
||||
- #6896 `d482c0a` Make -checkmempool=1 not fail through int32 overflow
|
||||
- #6993 `b632145` Add -blocksonly option
|
||||
- #7323 `a344880` 0.12: Backport -bytespersigop option
|
||||
- #7386 `da83ecd` Add option `-permitrbf` to set transaction replacement policy
|
||||
- #7290 `b16b5bc` Add missing options help
|
||||
|
||||
### Block and transaction handling
|
||||
|
||||
- #6203 `f00b623` Remove P2SH coinbase flag, no longer interesting
|
||||
- #6222 `9c93ee5` Explicitly set tx.nVersion for the genesis block and mining tests
|
||||
- #5985 `3a1d3e8` Fix removing of orphan transactions
|
||||
- #6221 `dd8fe82` Prune: Support noncontiguous block files
|
||||
- #6124 `41076aa` Mempool only CHECKLOCKTIMEVERIFY (BIP65) verification, unparameterized version
|
||||
- #6329 `d0a10c1` acceptnonstdtxn option to skip (most) "non-standard transaction" checks, for testnet/regtest only
|
||||
- #6410 `7cdefb9` Implement accurate memory accounting for mempool
|
||||
- #6444 `24ce77d` Exempt unspendable transaction outputs from dust checks
|
||||
- #5913 `a0625b8` Add absurdly high fee message to validation state
|
||||
- #6177 `2f746c6` Prevent block.nTime from decreasing
|
||||
- #6377 `e545371` Handle no chain tip available in InvalidChainFound()
|
||||
- #6551 `39ddaeb` Handle leveldb::DestroyDB() errors on wipe failure
|
||||
- #6654 `b0ce450` Mempool package tracking
|
||||
- #6715 `82d2aef` Fix mempool packages
|
||||
- #6680 `4f44530` use CBlockIndex instead of uint256 for UpdatedBlockTip signal
|
||||
- #6650 `4fac576` Obfuscate chainstate
|
||||
- #6777 `9caaf6e` Unobfuscate chainstate data in CCoinsViewDB::GetStats
|
||||
- #6722 `3b20e23` Limit mempool by throwing away the cheapest txn and setting min relay fee to it
|
||||
- #6889 `38369dd` fix locking issue with new mempool limiting
|
||||
- #6464 `8f3b3cd` Always clean up manual transaction prioritization
|
||||
- #6865 `d0badb9` Fix chainstate serialized_size computation
|
||||
- #6566 `ff057f4` BIP-113: Mempool-only median time-past as endpoint for lock-time calculations
|
||||
- #6934 `3038eb6` Restores mempool only BIP113 enforcement
|
||||
- #6965 `de7d459` Benchmark sanity checks and fork checks in ConnectBlock
|
||||
- #6918 `eb6172a` Make sigcache faster, more efficient, larger
|
||||
- #6771 `38ed190` Policy: Lower default limits for tx chains
|
||||
- #6932 `73fa5e6` ModifyNewCoins saves database lookups
|
||||
- #5967 `05d5918` Alter assumptions in CCoinsViewCache::BatchWrite
|
||||
- #6871 `0e93586` nSequence-based Full-RBF opt-in
|
||||
- #7008 `eb77416` Lower bound priority
|
||||
- #6915 `2ef5ffa` [Mempool] Improve removal of invalid transactions after reorgs
|
||||
- #6898 `4077ad2` Rewrite CreateNewBlock
|
||||
- #6872 `bdda4d5` Remove UTXO cache entries when the tx they were added for is removed/does not enter mempool
|
||||
- #7062 `12c469b` [Mempool] Fix mempool limiting and replace-by-fee for PrioritiseTransaction
|
||||
- #7276 `76de36f` Report non-mandatory script failures correctly
|
||||
- #7217 `e08b7cb` Mark blocks with too many sigops as failed
|
||||
- #7387 `f4b2ce8` Get rid of inaccurate ScriptSigArgsExpected
|
||||
|
||||
### P2P protocol and network code
|
||||
|
||||
- #6172 `88a7ead` Ignore getheaders requests when not synced
|
||||
- #5875 `9d60602` Be stricter in processing unrequested blocks
|
||||
- #6256 `8ccc07c` Use best header chain timestamps to detect partitioning
|
||||
- #6283 `a903ad7` make CAddrMan::size() return the correct type of size_t
|
||||
- #6272 `40400d5` Improve proxy initialization (continues #4871)
|
||||
- #6310 `66e5465` banlist.dat: store banlist on disk
|
||||
- #6412 `1a2de32` Test whether created sockets are select()able
|
||||
- #6498 `219b916` Keep track of recently rejected transactions with a rolling bloom filter (cont'd)
|
||||
- #6556 `70ec975` Fix masking of irrelevant bits in address groups.
|
||||
- #6530 `ea19c2b` Improve addrman Select() performance when buckets are nearly empty
|
||||
- #6583 `af9305a` add support for miniupnpc api version 14
|
||||
- #6374 `69dc5b5` Connection slot exhaustion DoS mitigation
|
||||
- #6636 `536207f` net: correctly initialize nMinPingUsecTime
|
||||
- #6579 `0c27795` Add NODE_BLOOM service bit and bump protocol version
|
||||
- #6148 `999c8be` Relay blocks when pruning
|
||||
- #6588 `cf9bb11` In (strCommand == "tx"), return if AlreadyHave()
|
||||
- #6974 `2f71b07` Always allow getheaders from whitelisted peers
|
||||
- #6639 `bd629d7` net: Automatically create hidden service, listen on Tor
|
||||
- #6984 `9ffc687` don't enforce maxuploadtarget's disconnect for whitelisted peers
|
||||
- #7046 `c322652` Net: Improve blocks only mode.
|
||||
- #7090 `d6454f6` Connect to Tor hidden services by default (when listening on Tor)
|
||||
- #7106 `c894fbb` Fix and improve relay from whitelisted peers
|
||||
- #7129 `5d5ef3a` Direct headers announcement (rebase of #6494)
|
||||
- #7079 `1b5118b` Prevent peer flooding inv request queue (redux) (redux)
|
||||
- #7166 `6ba25d2` Disconnect on mempool requests from peers when over the upload limit.
|
||||
- #7133 `f31955d` Replace setInventoryKnown with a rolling bloom filter (rebase of #7100)
|
||||
- #7174 `82aff88` Don't do mempool lookups for "mempool" command without a filter
|
||||
- #7179 `44fef99` net: Fix sent reject messages for blocks and transactions
|
||||
- #7181 `8fc174a` net: Add and document network messages in protocol.h
|
||||
- #7125 `10b88be` Replace global trickle node with random delays
|
||||
|
||||
### Validation
|
||||
|
||||
- #5927 `8d9f0a6` Reduce checkpoints' effect on consensus.
|
||||
- #6299 `24f2489` Bugfix: Don't check the genesis block header before accepting it
|
||||
- #6361 `d7ada03` Use real number of cores for default -par, ignore virtual cores
|
||||
- #6519 `87f37e2` Make logging for validation optional
|
||||
- #6351 `2a1090d` CHECKLOCKTIMEVERIFY (BIP65) IsSuperMajority() soft-fork
|
||||
- #6931 `54e8bfe` Skip BIP 30 verification where not necessary
|
||||
- #6954 `e54ebbf` Switch to libsecp256k1-based ECDSA validation
|
||||
- #6508 `61457c2` Switch to a constant-space Merkle root/branch algorithm.
|
||||
- #6914 `327291a` Add pre-allocated vector type and use it for CScript
|
||||
|
||||
### Build system
|
||||
|
||||
- #6210 `0e4f2a0` build: disable optional use of gmp in internal secp256k1 build
|
||||
- #6214 `87406aa` [OSX] revert renaming of Bitcoin-Qt.app and use CFBundleDisplayName (partial revert of #6116)
|
||||
- #6218 `9d67b10` build/gitian misc updates
|
||||
- #6269 `d4565b6` gitian: Use the new bitcoin-detached-sigs git repo for OSX signatures
|
||||
- #6418 `d4a910c` Add autogen.sh to source tarball.
|
||||
- #6373 `1ae3196` depends: non-qt bumps for 0.12
|
||||
- #6434 `059b352` Preserve user-passed CXXFLAGS with --enable-debug
|
||||
- #6501 `fee6554` Misc build fixes
|
||||
- #6600 `ef4945f` Include bitcoin-tx binary on Debian/Ubuntu
|
||||
- #6619 `4862708` depends: bump miniupnpc and ccache
|
||||
- #6801 `ae69a75` [depends] Latest config.guess and config.sub
|
||||
- #6938 `193f7b5` build: If both Qt4 and Qt5 are installed, use Qt5
|
||||
- #7092 `348b281` build: Set osx permissions in the dmg to make Gatekeeper happy
|
||||
- #6980 `eccd671` [Depends] Bump Boost, miniupnpc, ccache & zeromq
|
||||
|
||||
### Wallet
|
||||
|
||||
- #6183 `87550ee` Fix off-by-one error w/ nLockTime in the wallet
|
||||
- #6057 `ac5476e` re-enable wallet in autoprune
|
||||
- #6356 `9e6c33b` Delay initial pruning until after wallet init
|
||||
- #6088 `91389e5` fundrawtransaction
|
||||
- #6415 `ddd8d80` Implement watchonly support in fundrawtransaction
|
||||
- #6567 `0f0f323` Fix crash when mining with empty keypool.
|
||||
- #6688 `4939eab` Fix locking in GetTransaction.
|
||||
- #6645 `4dbd43e` Enable wallet key imports without rescan in pruned mode.
|
||||
- #6550 `5b77244` Do not store Merkle branches in the wallet.
|
||||
- #5924 `12a7712` Clean up change computation in CreateTransaction.
|
||||
- #6906 `48b5b84` Reject invalid pubkeys when reading ckey items from the wallet.
|
||||
- #7010 `e0a5ef8` Fix fundrawtransaction handling of includeWatching
|
||||
- #6851 `616d61b` Optimisation: Store transaction list order in memory rather than compute it every need
|
||||
- #6134 `e92377f` Improve usage of fee estimation code
|
||||
- #7103 `a775182` [wallet, rpc tests] Fix settxfee, paytxfee
|
||||
- #7105 `30c2d8c` Keep track of explicit wallet conflicts instead of using mempool
|
||||
- #7096 `9490bd7` [Wallet] Improve minimum absolute fee GUI options
|
||||
- #6216 `83f06ca` Take the training wheels off anti-fee-sniping
|
||||
- #4906 `96e8d12` Issue#1643: Coinselection prunes extraneous inputs from ApproximateBestSubset
|
||||
- #7200 `06c6a58` Checks for null data transaction before issuing error to debug.log
|
||||
- #7296 `a36d79b` Add sane fallback for fee estimation
|
||||
- #7293 `ff9b610` Add regression test for vValue sort order
|
||||
- #7306 `4707797` Make sure conflicted wallet tx's update balances
|
||||
- #7381 `621bbd8` [walletdb] Fix syntax error in key parser
|
||||
|
||||
### GUI
|
||||
|
||||
### Tests
|
||||
- #6217 `c57e12a` disconnect peers from peers tab via context menu
|
||||
- #6209 `ab0ec67` extend rpc console peers tab
|
||||
- #6484 `1369d69` use CHashWriter also in SignVerifyMessageDialog
|
||||
- #6487 `9848d42` Introduce PlatformStyle
|
||||
- #6505 `100c9d3` cleanup icons
|
||||
- #4587 `0c465f5` allow users to set -onion via GUI
|
||||
- #6529 `c0f66ce` show client user agent in debug window
|
||||
- #6594 `878ea69` Disallow duplicate windows.
|
||||
- #5665 `6f55cdd` add verifySize() function to PaymentServer
|
||||
- #6317 `ca5e2a1` minor optimisations in peertablemodel
|
||||
- #6315 `e59d2a8` allow banning and unbanning over UI->peers table
|
||||
- #6653 `e04b2fa` Pop debug window in foreground when opened twice
|
||||
- #6864 `c702521` Use monospace font
|
||||
- #6887 `3694b74` Update coin control and smartfee labels
|
||||
- #7000 `814697c` add shortcurts for debug-/console-window
|
||||
- #6951 `03403d8` Use maxTxFee instead of 10000000
|
||||
- #7051 `a190777` ui: Add "Copy raw transaction data" to transaction list context menu
|
||||
- #6979 `776848a` simple mempool info in debug window
|
||||
- #7006 `26af1ac` add startup option to reset Qt settings
|
||||
- #6780 `2a94cd6` Call init's parameter interaction before we create the UI options model
|
||||
- #7112 `96b8025` reduce cs_main locks during tip update, more fluently update UI
|
||||
- #7206 `f43c2f9` Add "NODE_BLOOM" to guiutil so that peers don't get UNKNOWN[4]
|
||||
- #7282 `5cadf3e` fix coincontrol update issue when deleting a send coins entry
|
||||
- #7319 `1320300` Intro: Display required space
|
||||
- #7318 `9265e89` quickfix for RPC timer interface problem
|
||||
- #7327 `b16b5bc` [Wallet] Transaction View: LastMonth calculation fixed
|
||||
- #7364 `7726c48` [qt] Windows: Make rpcconsole monospace font larger
|
||||
|
||||
### Tests and QA
|
||||
|
||||
- #6305 `9005c91` build: comparison tool swap
|
||||
- #6318 `e307e13` build: comparison tool NPE fix
|
||||
- #6337 `0564c5b` Testing infrastructure: mocktime fixes
|
||||
- #6350 `60abba1` add unit tests for the decodescript rpc
|
||||
- #5881 `3203a08` Fix and improve txn_doublespend.py test
|
||||
- #6390 `6a73d66` tests: Fix bitcoin-tx signing test case
|
||||
- #6368 `7fc25c2` CLTV: Add more tests to improve coverage
|
||||
- #6414 `5121c68` Fix intermittent test failure, reduce test time
|
||||
- #6417 `44fa82d` [QA] fix possible reorg issue in (fund)rawtransaction(s).py RPC test
|
||||
- #6398 `3d9362d` rpc: Remove chain-specific RequireRPCPassword
|
||||
- #6428 `bb59e78` tests: Remove old sh-based test framework
|
||||
- #5515 `d946e9a` RFC: Assert on probable deadlocks if the second lock isnt try_lock
|
||||
- #6287 `d2464df` Clang lock debug
|
||||
- #6465 `410fd74` Don't share objects between TestInstances
|
||||
- #6534 `6c1c7fd` Fix test locking issues and un-revert the probable-deadlines assertions commit
|
||||
- #6509 `bb4faee` Fix race condition on test node shutdown
|
||||
- #6523 `561f8af` Add p2p-fullblocktest.py
|
||||
- #6590 `981fd92` Fix stale socket rebinding and re-enable python tests for Windows
|
||||
- #6730 `cb4d6d0` build: Remove dependency of bitcoin-cli on secp256k1
|
||||
- #6616 `5ab5dca` Regression Tests: Migrated rpc-tests.sh to all Python rpc-tests.py
|
||||
- #6720 `d479311` Creates unittests for addrman, makes addrman more testable.
|
||||
- #6853 `c834f56` Added fPowNoRetargeting field to Consensus::Params
|
||||
- #6827 `87e5539` [rpc-tests] Check return code
|
||||
- #6848 `f2c869a` Add DERSIG transaction test cases
|
||||
- #6813 `5242bb3` Support gathering code coverage data for RPC tests with lcov
|
||||
- #6888 `c8322ff` Clear strMiscWarning before running PartitionAlert
|
||||
- #6894 `2675276` [Tests] Fix BIP65 p2p test
|
||||
- #6863 `725539e` [Test Suite] Fix test for null tx input
|
||||
- #6926 `a6d0d62` tests: Initialize networking on windows
|
||||
- #6822 `9fa54a1` [tests] Be more strict checking dust
|
||||
- #6804 `5fcc14e` [tests] Add basic coverage reporting for RPC tests
|
||||
- #7045 `72dccfc` Bugfix: Use unique autostart filenames on Linux for testnet/regtest
|
||||
- #7095 `d8368a0` Replace scriptnum_test's normative ScriptNum implementation
|
||||
- #7063 `6abf6eb` [Tests] Add prioritisetransaction RPC test
|
||||
- #7137 `16f4a6e` Tests: Explicitly set chain limits in replace-by-fee test
|
||||
- #7216 `9572e49` Removed offline testnet DNSSeed 'alexykot.me'.
|
||||
- #7209 `f3ad812` test: don't override BITCOIND and BITCOINCLI if they're set
|
||||
- #7226 `301f16a` Tests: Add more tests to p2p-fullblocktest
|
||||
- #7153 `9ef7c54` [Tests] Add mempool_limit.py test
|
||||
- #7170 `453c567` tests: Disable Tor interaction
|
||||
- #7229 `1ed938b` [qa] wallet: Check if maintenance changes the balance
|
||||
- #7308 `d513405` [Tests] Eliminate intermittent failures in sendheaders.py
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
- Removed bitrpc.py from contrib
|
||||
- #6213 `e54ff2f` [init] add -blockversion help and extend -upnp help
|
||||
- #5975 `1fea667` Consensus: Decouple ContextualCheckBlockHeader from checkpoints
|
||||
- #6061 `eba2f06` Separate Consensus::CheckTxInputs and GetSpendHeight in CheckInputs
|
||||
- #5994 `786ed11` detach wallet from miner
|
||||
- #6387 `11576a5` [bitcoin-cli] improve error output
|
||||
- #6401 `6db53b4` Add BITCOIND_SIGTERM_TIMEOUT to OpenRC init scripts
|
||||
- #6430 `b01981e` doc: add documentation for shared library libbitcoinconsensus
|
||||
- #6372 `dcc495e` Update Linearize tool to support Windows paths; fix variable scope; update README and example configuration
|
||||
- #6453 `8fe5cce` Separate core memory usage computation in core_memusage.h
|
||||
- #6149 `633fe10` Buffer log messages and explicitly open logs
|
||||
- #6488 `7cbed7f` Avoid leaking file descriptors in RegisterLoad
|
||||
- #6497 `a2bf40d` Make sure LogPrintf strings are line-terminated
|
||||
- #6504 `b6fee6b` Rationalize currency unit to "BTC"
|
||||
- #6507 `9bb4dd8` Removed contrib/bitrpc
|
||||
- #6527 `41d650f` Use unique name for AlertNotify tempfile
|
||||
- #6561 `e08a7d9` limitedmap fixes and tests
|
||||
- #6565 `a6f2aff` Make sure we re-acquire lock if a task throws
|
||||
- #6599 `f4d88c4` Make sure LogPrint strings are line-terminated
|
||||
- #6630 `195942d` Replace boost::reverse_lock with our own
|
||||
- #6103 `13b8282` Add ZeroMQ notifications
|
||||
- #6692 `d5d1d2e` devtools: don't push if signing fails in github-merge
|
||||
- #6728 `2b0567b` timedata: Prevent warning overkill
|
||||
- #6713 `f6ce59c` SanitizeString: Allow hypen char
|
||||
- #5987 `4899a04` Bugfix: Fix testnet-in-a-box use case
|
||||
- #6733 `b7d78fd` Simple benchmarking framework
|
||||
- #6854 `a092970` devtools: Add security-check.py
|
||||
- #6790 `fa1d252` devtools: add clang-format.py
|
||||
- #7114 `f3d0fdd` util: Don't set strMiscWarning on every exception
|
||||
- #7078 `93e0514` uint256::GetCheapHash bigendian compatibility
|
||||
- #7094 `34e02e0` Assert now > 0 in GetTime GetTimeMillis GetTimeMicros
|
||||
|
||||
Addition of ZMQ-based Notifications
|
||||
==================================
|
||||
Credits
|
||||
=======
|
||||
|
||||
Thanks to everyone who directly contributed to this release:
|
||||
|
||||
- accraze
|
||||
- Adam Weiss
|
||||
- Alex Morcos
|
||||
- Alex van der Peet
|
||||
- AlSzacrel
|
||||
- Altoidnerd
|
||||
- Andriy Voskoboinyk
|
||||
- antonio-fr
|
||||
- Arne Brutschy
|
||||
- Ashley Holman
|
||||
- Bob McElrath
|
||||
- Braydon Fuller
|
||||
- BtcDrak
|
||||
- Casey Rodarmor
|
||||
- centaur1
|
||||
- Chris Kleeschulte
|
||||
- Christian Decker
|
||||
- Cory Fields
|
||||
- daniel
|
||||
- Daniel Cousens
|
||||
- Daniel Kraft
|
||||
- David Hill
|
||||
- dexX7
|
||||
- Diego Viola
|
||||
- Elias Rohrer
|
||||
- Eric Lombrozo
|
||||
- Erik Mossberg
|
||||
- Esteban Ordano
|
||||
- EthanHeilman
|
||||
- fanquake
|
||||
- Florian Schmaus
|
||||
- Forrest Voight
|
||||
- Gavin Andresen
|
||||
- Gregory Maxwell
|
||||
- Gregory Sanders
|
||||
- Ian T
|
||||
- Irving Ruan
|
||||
- Jacob Welsh
|
||||
- James O'Beirne
|
||||
- Jeff Garzik
|
||||
- Johnathan Corgan
|
||||
- Jonas Schnelli
|
||||
- Jonathan Cross
|
||||
- João Barbosa
|
||||
- Jorge Timón
|
||||
- Josh Lehan
|
||||
- J Ross Nicoll
|
||||
- kazcw
|
||||
- Kevin Cooper
|
||||
- lpescher
|
||||
- Luke Dashjr
|
||||
- Marco
|
||||
- MarcoFalke
|
||||
- Mark Friedenbach
|
||||
- Matt Bogosian
|
||||
- Matt Corallo
|
||||
- Matt Quinn
|
||||
- Micha
|
||||
- Michael
|
||||
- Michael Ford
|
||||
- Midnight Magic
|
||||
- Mitchell Cash
|
||||
- mruddy
|
||||
- Nick
|
||||
- Patick Strateman
|
||||
- Patrick Strateman
|
||||
- Paul Georgiou
|
||||
- Paul Rabahy
|
||||
- paveljanik
|
||||
- Pavel Janík
|
||||
- Pavel Vasin
|
||||
- Pavol Rusnak
|
||||
- Peter Josling
|
||||
- Peter Todd
|
||||
- Philip Kaufmann
|
||||
- Pieter Wuille
|
||||
- ptschip
|
||||
- randy-waterhouse
|
||||
- rion
|
||||
- Ross Nicoll
|
||||
- Ryan Havar
|
||||
- Shaul Kfir
|
||||
- Simon Males
|
||||
- Stephen
|
||||
- Suhas Daftuar
|
||||
- tailsjoin
|
||||
- ฿tcDrak
|
||||
- Thomas Kerin
|
||||
- Tom Harding
|
||||
- tulip
|
||||
- unsystemizer
|
||||
- Veres Lajos
|
||||
- Wladimir J. van der Laan
|
||||
- Zak Wilcox
|
||||
- zathras-crypto
|
||||
|
||||
As well as everyone that helped translating on [Transifex](https://www.transifex.com/projects/p/bitcoin/).
|
||||
|
||||
Bitcoind can now (optionally) asynchronously notify clients through a
|
||||
ZMQ-based PUB socket of the arrival of new transactions and blocks.
|
||||
This feature requires installation of the ZMQ C API library 4.x and
|
||||
configuring its use through the command line or configuration file.
|
||||
Please see docs/zmq.md for details of operation.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -62,8 +62,10 @@ for arg in sys.argv[1:]:
|
||||
|
||||
#Set env vars
|
||||
buildDir = BUILDDIR
|
||||
os.environ["BITCOIND"] = buildDir + '/src/bitcoind' + EXEEXT
|
||||
os.environ["BITCOINCLI"] = buildDir + '/src/bitcoin-cli' + EXEEXT
|
||||
if "BITCOIND" not in os.environ:
|
||||
os.environ["BITCOIND"] = buildDir + '/src/bitcoind' + EXEEXT
|
||||
if "BITCOINCLI" not in os.environ:
|
||||
os.environ["BITCOINCLI"] = buildDir + '/src/bitcoin-cli' + EXEEXT
|
||||
|
||||
#Disable Windows tests by default
|
||||
if EXEEXT == ".exe" and "-win" not in opts:
|
||||
@@ -83,6 +85,7 @@ testScripts = [
|
||||
'rest.py',
|
||||
'mempool_spendcoinbase.py',
|
||||
'mempool_reorg.py',
|
||||
'mempool_limit.py',
|
||||
'httpbasics.py',
|
||||
'multi_rpc.py',
|
||||
'zapwallettxes.py',
|
||||
@@ -100,6 +103,9 @@ testScripts = [
|
||||
'sendheaders.py',
|
||||
'keypool.py',
|
||||
'prioritise_transaction.py',
|
||||
'invalidblockrequest.py',
|
||||
'invalidtxrequest.py',
|
||||
'abandonconflict.py',
|
||||
]
|
||||
testScriptsExt = [
|
||||
'bip65-cltv.py',
|
||||
@@ -116,7 +122,6 @@ testScriptsExt = [
|
||||
# 'rpcbind_test.py', #temporary, bug in libevent, see #6655
|
||||
'smartfees.py',
|
||||
'maxblocksinflight.py',
|
||||
'invalidblockrequest.py',
|
||||
'p2p-acceptblock.py',
|
||||
'mempool_packages.py',
|
||||
'maxuploadtarget.py',
|
||||
|
||||
@@ -47,10 +47,7 @@ implements the test logic.
|
||||
* ```NodeConn``` is the class used to connect to a bitcoind. If you implement
|
||||
a callback class that derives from ```NodeConnCB``` and pass that to the
|
||||
```NodeConn``` object, your code will receive the appropriate callbacks when
|
||||
events of interest arrive. NOTE: be sure to call
|
||||
```self.create_callback_map()``` in your derived classes' ```__init__```
|
||||
function, so that the correct mappings are set up between p2p messages and your
|
||||
callback functions.
|
||||
events of interest arrive.
|
||||
|
||||
* You can pass the same handler to multiple ```NodeConn```'s if you like, or pass
|
||||
different ones to each -- whatever makes the most sense for your test.
|
||||
|
||||
153
qa/rpc-tests/abandonconflict.py
Executable file
153
qa/rpc-tests/abandonconflict.py
Executable file
@@ -0,0 +1,153 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
try:
|
||||
import urllib.parse as urlparse
|
||||
except ImportError:
|
||||
import urlparse
|
||||
|
||||
class AbandonConflictTest(BitcoinTestFramework):
|
||||
|
||||
def setup_network(self):
|
||||
self.nodes = []
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.00001"]))
|
||||
self.nodes.append(start_node(1, self.options.tmpdir, ["-debug","-logtimemicros"]))
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
|
||||
def run_test(self):
|
||||
self.nodes[1].generate(100)
|
||||
sync_blocks(self.nodes)
|
||||
balance = self.nodes[0].getbalance()
|
||||
txA = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), Decimal("10"))
|
||||
txB = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), Decimal("10"))
|
||||
txC = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), Decimal("10"))
|
||||
sync_mempools(self.nodes)
|
||||
self.nodes[1].generate(1)
|
||||
|
||||
sync_blocks(self.nodes)
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert(balance - newbalance < Decimal("0.001")) #no more than fees lost
|
||||
balance = newbalance
|
||||
|
||||
url = urlparse.urlparse(self.nodes[1].url)
|
||||
self.nodes[0].disconnectnode(url.hostname+":"+str(p2p_port(1)))
|
||||
|
||||
# Identify the 10btc outputs
|
||||
nA = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txA, 1)["vout"]) if vout["value"] == Decimal("10"))
|
||||
nB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txB, 1)["vout"]) if vout["value"] == Decimal("10"))
|
||||
nC = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txC, 1)["vout"]) if vout["value"] == Decimal("10"))
|
||||
|
||||
inputs =[]
|
||||
# spend 10btc outputs from txA and txB
|
||||
inputs.append({"txid":txA, "vout":nA})
|
||||
inputs.append({"txid":txB, "vout":nB})
|
||||
outputs = {}
|
||||
|
||||
outputs[self.nodes[0].getnewaddress()] = Decimal("14.99998")
|
||||
outputs[self.nodes[1].getnewaddress()] = Decimal("5")
|
||||
signed = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs))
|
||||
txAB1 = self.nodes[0].sendrawtransaction(signed["hex"])
|
||||
|
||||
# Identify the 14.99998btc output
|
||||
nAB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txAB1, 1)["vout"]) if vout["value"] == Decimal("14.99998"))
|
||||
|
||||
#Create a child tx spending AB1 and C
|
||||
inputs = []
|
||||
inputs.append({"txid":txAB1, "vout":nAB})
|
||||
inputs.append({"txid":txC, "vout":nC})
|
||||
outputs = {}
|
||||
outputs[self.nodes[0].getnewaddress()] = Decimal("24.9996")
|
||||
signed2 = self.nodes[0].signrawtransaction(self.nodes[0].createrawtransaction(inputs, outputs))
|
||||
txABC2 = self.nodes[0].sendrawtransaction(signed2["hex"])
|
||||
|
||||
# In mempool txs from self should increase balance from change
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert(newbalance == balance - Decimal("30") + Decimal("24.9996"))
|
||||
balance = newbalance
|
||||
|
||||
# Restart the node with a higher min relay fee so the parent tx is no longer in mempool
|
||||
# TODO: redo with eviction
|
||||
# Note had to make sure tx did not have AllowFree priority
|
||||
stop_node(self.nodes[0],0)
|
||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.0001"])
|
||||
|
||||
# Verify txs no longer in mempool
|
||||
assert(len(self.nodes[0].getrawmempool()) == 0)
|
||||
|
||||
# Not in mempool txs from self should only reduce balance
|
||||
# inputs are still spent, but change not received
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert(newbalance == balance - Decimal("24.9996"))
|
||||
balance = newbalance
|
||||
|
||||
# Abandon original transaction and verify inputs are available again
|
||||
# including that the child tx was also abandoned
|
||||
self.nodes[0].abandontransaction(txAB1)
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert(newbalance == balance + Decimal("30"))
|
||||
balance = newbalance
|
||||
|
||||
# Verify that even with a low min relay fee, the tx is not reaccepted from wallet on startup once abandoned
|
||||
stop_node(self.nodes[0],0)
|
||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.00001"])
|
||||
assert(len(self.nodes[0].getrawmempool()) == 0)
|
||||
assert(self.nodes[0].getbalance() == balance)
|
||||
|
||||
# But if its received again then it is unabandoned
|
||||
# And since now in mempool, the change is available
|
||||
# But its child tx remains abandoned
|
||||
self.nodes[0].sendrawtransaction(signed["hex"])
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert(newbalance == balance - Decimal("20") + Decimal("14.99998"))
|
||||
balance = newbalance
|
||||
|
||||
# Send child tx again so its unabandoned
|
||||
self.nodes[0].sendrawtransaction(signed2["hex"])
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert(newbalance == balance - Decimal("10") - Decimal("14.99998") + Decimal("24.9996"))
|
||||
balance = newbalance
|
||||
|
||||
# Remove using high relay fee again
|
||||
stop_node(self.nodes[0],0)
|
||||
self.nodes[0]=start_node(0, self.options.tmpdir, ["-debug","-logtimemicros","-minrelaytxfee=0.0001"])
|
||||
assert(len(self.nodes[0].getrawmempool()) == 0)
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert(newbalance == balance - Decimal("24.9996"))
|
||||
balance = newbalance
|
||||
|
||||
# Create a double spend of AB1 by spending again from only A's 10 output
|
||||
# Mine double spend from node 1
|
||||
inputs =[]
|
||||
inputs.append({"txid":txA, "vout":nA})
|
||||
outputs = {}
|
||||
outputs[self.nodes[1].getnewaddress()] = Decimal("9.9999")
|
||||
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
signed = self.nodes[0].signrawtransaction(tx)
|
||||
self.nodes[1].sendrawtransaction(signed["hex"])
|
||||
self.nodes[1].generate(1)
|
||||
|
||||
connect_nodes(self.nodes[0], 1)
|
||||
sync_blocks(self.nodes)
|
||||
|
||||
# Verify that B and C's 10 BTC outputs are available for spending again because AB1 is now conflicted
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
assert(newbalance == balance + Decimal("20"))
|
||||
balance = newbalance
|
||||
|
||||
# There is currently a minor bug around this and so this test doesn't work. See Issue #7315
|
||||
# Invalidate the block with the double spend and B's 10 BTC output should no longer be available
|
||||
# Don't think C's should either
|
||||
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
|
||||
newbalance = self.nodes[0].getbalance()
|
||||
#assert(newbalance == balance - Decimal("10"))
|
||||
print "If balance has not declined after invalidateblock then out of mempool wallet tx which is no longer"
|
||||
print "conflicted has not resumed causing its inputs to be seen as spent. See Issue #7315"
|
||||
print balance , " -> " , newbalance , " ?"
|
||||
|
||||
if __name__ == '__main__':
|
||||
AbandonConflictTest().main()
|
||||
@@ -9,8 +9,8 @@ from test_framework.util import *
|
||||
from test_framework.mininode import CTransaction, NetworkThread
|
||||
from test_framework.blocktools import create_coinbase, create_block
|
||||
from test_framework.comptool import TestInstance, TestManager
|
||||
from test_framework.script import CScript, OP_1NEGATE, OP_NOP2, OP_DROP
|
||||
from binascii import hexlify, unhexlify
|
||||
from test_framework.script import CScript, OP_1NEGATE, OP_CHECKLOCKTIMEVERIFY, OP_DROP
|
||||
from binascii import unhexlify
|
||||
import cStringIO
|
||||
import time
|
||||
|
||||
@@ -19,7 +19,7 @@ def cltv_invalidate(tx):
|
||||
|
||||
Prepends -1 CLTV DROP in the scriptSig itself.
|
||||
'''
|
||||
tx.vin[0].scriptSig = CScript([OP_1NEGATE, OP_NOP2, OP_DROP] +
|
||||
tx.vin[0].scriptSig = CScript([OP_1NEGATE, OP_CHECKLOCKTIMEVERIFY, OP_DROP] +
|
||||
list(CScript(tx.vin[0].scriptSig)))
|
||||
|
||||
'''
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
class BIP65Test(BitcoinTestFramework):
|
||||
|
||||
@@ -46,7 +44,7 @@ class BIP65Test(BitcoinTestFramework):
|
||||
self.nodes[2].generate(1)
|
||||
self.sync_all()
|
||||
if (self.nodes[0].getblockcount() != cnt + 851):
|
||||
raise AssertionFailure("Failed to mine a version=4 blocks")
|
||||
raise AssertionError("Failed to mine a version=4 blocks")
|
||||
|
||||
# TODO: check that new CHECKLOCKTIMEVERIFY rules are enforced
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ from test_framework.mininode import CTransaction, NetworkThread
|
||||
from test_framework.blocktools import create_coinbase, create_block
|
||||
from test_framework.comptool import TestInstance, TestManager
|
||||
from test_framework.script import CScript
|
||||
from binascii import hexlify, unhexlify
|
||||
from binascii import unhexlify
|
||||
import cStringIO
|
||||
import time
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
class BIP66Test(BitcoinTestFramework):
|
||||
|
||||
@@ -46,7 +44,7 @@ class BIP66Test(BitcoinTestFramework):
|
||||
self.nodes[2].generate(1)
|
||||
self.sync_all()
|
||||
if (self.nodes[0].getblockcount() != cnt + 851):
|
||||
raise AssertionFailure("Failed to mine a version=3 blocks")
|
||||
raise AssertionError("Failed to mine a version=3 blocks")
|
||||
|
||||
# TODO: check that new DERSIG rules are enforced
|
||||
|
||||
|
||||
@@ -1,22 +1,28 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#
|
||||
# Test RPC calls related to blockchain state.
|
||||
# Test RPC calls related to blockchain state. Tests correspond to code in
|
||||
# rpcblockchain.cpp.
|
||||
#
|
||||
|
||||
import decimal
|
||||
from decimal import Decimal
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.authproxy import JSONRPCException
|
||||
from test_framework.util import (
|
||||
initialize_chain,
|
||||
assert_equal,
|
||||
assert_raises,
|
||||
assert_is_hex_string,
|
||||
assert_is_hash_string,
|
||||
start_nodes,
|
||||
connect_nodes_bi,
|
||||
)
|
||||
|
||||
|
||||
class BlockchainTest(BitcoinTestFramework):
|
||||
"""
|
||||
Test blockchain-related RPC calls:
|
||||
@@ -36,10 +42,14 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
self.sync_all()
|
||||
|
||||
def run_test(self):
|
||||
self._test_gettxoutsetinfo()
|
||||
self._test_getblockheader()
|
||||
|
||||
def _test_gettxoutsetinfo(self):
|
||||
node = self.nodes[0]
|
||||
res = node.gettxoutsetinfo()
|
||||
|
||||
assert_equal(res[u'total_amount'], decimal.Decimal('8725.00000000'))
|
||||
assert_equal(res[u'total_amount'], Decimal('8725.00000000'))
|
||||
assert_equal(res[u'transactions'], 200)
|
||||
assert_equal(res[u'height'], 200)
|
||||
assert_equal(res[u'txouts'], 200)
|
||||
@@ -47,6 +57,30 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
assert_equal(len(res[u'bestblock']), 64)
|
||||
assert_equal(len(res[u'hash_serialized']), 64)
|
||||
|
||||
def _test_getblockheader(self):
|
||||
node = self.nodes[0]
|
||||
|
||||
assert_raises(
|
||||
JSONRPCException, lambda: node.getblockheader('nonsense'))
|
||||
|
||||
besthash = node.getbestblockhash()
|
||||
secondbesthash = node.getblockhash(199)
|
||||
header = node.getblockheader(besthash)
|
||||
|
||||
assert_equal(header['hash'], besthash)
|
||||
assert_equal(header['height'], 200)
|
||||
assert_equal(header['confirmations'], 1)
|
||||
assert_equal(header['previousblockhash'], secondbesthash)
|
||||
assert_is_hex_string(header['chainwork'])
|
||||
assert_is_hash_string(header['hash'])
|
||||
assert_is_hash_string(header['previousblockhash'])
|
||||
assert_is_hash_string(header['merkleroot'])
|
||||
assert_is_hash_string(header['bits'], length=None)
|
||||
assert isinstance(header['time'], int)
|
||||
assert isinstance(header['mediantime'], int)
|
||||
assert isinstance(header['nonce'], int)
|
||||
assert isinstance(header['version'], int)
|
||||
assert isinstance(header['difficulty'], Decimal)
|
||||
|
||||
if __name__ == '__main__':
|
||||
BlockchainTest().main()
|
||||
|
||||
@@ -102,13 +102,13 @@ class DecodeScriptTest(BitcoinTestFramework):
|
||||
# OP_IF
|
||||
# <receiver-pubkey> OP_CHECKSIGVERIFY
|
||||
# OP_ELSE
|
||||
# <lock-until> OP_NOP2 OP_DROP
|
||||
# <lock-until> OP_CHECKLOCKTIMEVERIFY OP_DROP
|
||||
# OP_ENDIF
|
||||
# <sender-pubkey> OP_CHECKSIG
|
||||
#
|
||||
# lock until block 500,000
|
||||
rpc_result = self.nodes[0].decodescript('63' + push_public_key + 'ad670320a107b17568' + push_public_key + 'ac')
|
||||
assert_equal('OP_IF ' + public_key + ' OP_CHECKSIGVERIFY OP_ELSE 500000 OP_NOP2 OP_DROP OP_ENDIF ' + public_key + ' OP_CHECKSIG', rpc_result['asm'])
|
||||
assert_equal('OP_IF ' + public_key + ' OP_CHECKSIGVERIFY OP_ELSE 500000 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_ENDIF ' + public_key + ' OP_CHECKSIG', rpc_result['asm'])
|
||||
|
||||
def decoderawtransaction_asm_sighashtype(self):
|
||||
"""Tests decoding scripts via RPC command "decoderawtransaction".
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
|
||||
class DisableWalletTest (BitcoinTestFramework):
|
||||
|
||||
def setup_chain(self):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
class ForkNotifyTest(BitcoinTestFramework):
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
from pprint import pprint
|
||||
from time import sleep
|
||||
|
||||
# Create one-input, one-output, no-fee transaction:
|
||||
class RawTransactionsTest(BitcoinTestFramework):
|
||||
@@ -30,6 +28,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
print "Mining blocks..."
|
||||
|
||||
min_relay_tx_fee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||
# This test is not meant to test fee estimation and we'd like
|
||||
# to be sure all txs are sent at a consistent desired feerate
|
||||
for node in self.nodes:
|
||||
node.settxfee(min_relay_tx_fee)
|
||||
|
||||
# if the fee's positive delta is higher than this value tests will fail,
|
||||
# neg. delta always fail the tests.
|
||||
# The size of the signature of every input may be at most 2 bytes larger
|
||||
@@ -48,11 +51,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
watchonly_amount = 200
|
||||
self.nodes[3].importpubkey(watchonly_pubkey, "", True)
|
||||
watchonly_txid = self.nodes[0].sendtoaddress(watchonly_address, watchonly_amount)
|
||||
self.nodes[0].sendtoaddress(self.nodes[3].getnewaddress(), watchonly_amount / 10);
|
||||
self.nodes[0].sendtoaddress(self.nodes[3].getnewaddress(), watchonly_amount / 10)
|
||||
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),1.5);
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),1.0);
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),5.0);
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.5)
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.0)
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 5.0)
|
||||
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(1)
|
||||
@@ -125,7 +128,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
for aUtx in listunspent:
|
||||
if aUtx['amount'] == 5.0:
|
||||
utx = aUtx
|
||||
break;
|
||||
break
|
||||
|
||||
assert_equal(utx!=False, True)
|
||||
|
||||
@@ -154,7 +157,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
for aUtx in listunspent:
|
||||
if aUtx['amount'] == 5.0:
|
||||
utx = aUtx
|
||||
break;
|
||||
break
|
||||
|
||||
assert_equal(utx!=False, True)
|
||||
|
||||
@@ -184,7 +187,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
for aUtx in listunspent:
|
||||
if aUtx['amount'] == 1.0:
|
||||
utx = aUtx
|
||||
break;
|
||||
break
|
||||
|
||||
assert_equal(utx!=False, True)
|
||||
|
||||
@@ -309,7 +312,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
except JSONRPCException,e:
|
||||
errorString = e.error['message']
|
||||
|
||||
assert_equal("Insufficient" in errorString, True);
|
||||
assert("Insufficient" in errorString)
|
||||
|
||||
|
||||
|
||||
@@ -321,11 +324,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
fundedTx = self.nodes[0].fundrawtransaction(rawTx)
|
||||
|
||||
#create same transaction over sendtoaddress
|
||||
txId = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1.1);
|
||||
txId = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1.1)
|
||||
signedFee = self.nodes[0].getrawmempool(True)[txId]['fee']
|
||||
|
||||
#compare fee
|
||||
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee);
|
||||
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee)
|
||||
assert(feeDelta >= 0 and feeDelta <= feeTolerance)
|
||||
############################################################
|
||||
|
||||
@@ -336,11 +339,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
rawTx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
fundedTx = self.nodes[0].fundrawtransaction(rawTx)
|
||||
#create same transaction over sendtoaddress
|
||||
txId = self.nodes[0].sendmany("", outputs);
|
||||
txId = self.nodes[0].sendmany("", outputs)
|
||||
signedFee = self.nodes[0].getrawmempool(True)[txId]['fee']
|
||||
|
||||
#compare fee
|
||||
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee);
|
||||
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee)
|
||||
assert(feeDelta >= 0 and feeDelta <= feeTolerance)
|
||||
############################################################
|
||||
|
||||
@@ -363,11 +366,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
fundedTx = self.nodes[0].fundrawtransaction(rawTx)
|
||||
|
||||
#create same transaction over sendtoaddress
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 1.1);
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 1.1)
|
||||
signedFee = self.nodes[0].getrawmempool(True)[txId]['fee']
|
||||
|
||||
#compare fee
|
||||
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee);
|
||||
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee)
|
||||
assert(feeDelta >= 0 and feeDelta <= feeTolerance)
|
||||
############################################################
|
||||
|
||||
@@ -396,11 +399,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
fundedTx = self.nodes[0].fundrawtransaction(rawTx)
|
||||
|
||||
#create same transaction over sendtoaddress
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 1.1);
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 1.1)
|
||||
signedFee = self.nodes[0].getrawmempool(True)[txId]['fee']
|
||||
|
||||
#compare fee
|
||||
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee);
|
||||
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee)
|
||||
assert(feeDelta >= 0 and feeDelta <= feeTolerance)
|
||||
############################################################
|
||||
|
||||
@@ -419,7 +422,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
|
||||
|
||||
# send 1.2 BTC to msig addr
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 1.2);
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 1.2)
|
||||
self.sync_all()
|
||||
self.nodes[1].generate(1)
|
||||
self.sync_all()
|
||||
@@ -447,6 +450,10 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
wait_bitcoinds()
|
||||
|
||||
self.nodes = start_nodes(4, self.options.tmpdir)
|
||||
# This test is not meant to test fee estimation and we'd like
|
||||
# to be sure all txs are sent at a consistent desired feerate
|
||||
for node in self.nodes:
|
||||
node.settxfee(min_relay_tx_fee)
|
||||
|
||||
connect_nodes_bi(self.nodes,0,1)
|
||||
connect_nodes_bi(self.nodes,1,2)
|
||||
@@ -457,7 +464,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
|
||||
error = False
|
||||
try:
|
||||
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1.2);
|
||||
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1.2)
|
||||
except:
|
||||
error = True
|
||||
assert(error)
|
||||
@@ -487,13 +494,13 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
###############################################
|
||||
|
||||
#empty node1, send some small coins from node0 to node1
|
||||
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance(), "", "", True);
|
||||
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance(), "", "", True)
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
for i in range(0,20):
|
||||
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.01);
|
||||
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.01)
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
@@ -505,11 +512,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
fundedTx = self.nodes[1].fundrawtransaction(rawTx)
|
||||
|
||||
#create same transaction over sendtoaddress
|
||||
txId = self.nodes[1].sendmany("", outputs);
|
||||
txId = self.nodes[1].sendmany("", outputs)
|
||||
signedFee = self.nodes[1].getrawmempool(True)[txId]['fee']
|
||||
|
||||
#compare fee
|
||||
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee);
|
||||
feeDelta = Decimal(fundedTx['fee']) - Decimal(signedFee)
|
||||
assert(feeDelta >= 0 and feeDelta <= feeTolerance*19) #~19 inputs
|
||||
|
||||
|
||||
@@ -518,13 +525,13 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
#############################################
|
||||
|
||||
#again, empty node1, send some small coins from node0 to node1
|
||||
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance(), "", "", True);
|
||||
self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), self.nodes[1].getbalance(), "", "", True)
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
for i in range(0,20):
|
||||
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.01);
|
||||
self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.01)
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -23,8 +23,8 @@ class GetChainTipsTest (BitcoinTestFramework):
|
||||
|
||||
# Split the network and build two chains of different lengths.
|
||||
self.split_network ()
|
||||
self.nodes[0].generate(10);
|
||||
self.nodes[2].generate(20);
|
||||
self.nodes[0].generate(10)
|
||||
self.nodes[2].generate(20)
|
||||
self.sync_all ()
|
||||
|
||||
tips = self.nodes[1].getchaintips ()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -36,13 +36,13 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
conn = httplib.HTTPConnection(url.hostname, url.port)
|
||||
conn.connect()
|
||||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read();
|
||||
out1 = conn.getresponse().read()
|
||||
assert_equal('"error":null' in out1, True)
|
||||
assert_equal(conn.sock!=None, True) #according to http/1.1 connection must still be open!
|
||||
|
||||
#send 2nd request without closing connection
|
||||
conn.request('POST', '/', '{"method": "getchaintips"}', headers)
|
||||
out2 = conn.getresponse().read();
|
||||
out2 = conn.getresponse().read()
|
||||
assert_equal('"error":null' in out1, True) #must also response with a correct json-rpc message
|
||||
assert_equal(conn.sock!=None, True) #according to http/1.1 connection must still be open!
|
||||
conn.close()
|
||||
@@ -53,13 +53,13 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
conn = httplib.HTTPConnection(url.hostname, url.port)
|
||||
conn.connect()
|
||||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read();
|
||||
out1 = conn.getresponse().read()
|
||||
assert_equal('"error":null' in out1, True)
|
||||
assert_equal(conn.sock!=None, True) #according to http/1.1 connection must still be open!
|
||||
|
||||
#send 2nd request without closing connection
|
||||
conn.request('POST', '/', '{"method": "getchaintips"}', headers)
|
||||
out2 = conn.getresponse().read();
|
||||
out2 = conn.getresponse().read()
|
||||
assert_equal('"error":null' in out1, True) #must also response with a correct json-rpc message
|
||||
assert_equal(conn.sock!=None, True) #according to http/1.1 connection must still be open!
|
||||
conn.close()
|
||||
@@ -70,7 +70,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
conn = httplib.HTTPConnection(url.hostname, url.port)
|
||||
conn.connect()
|
||||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read();
|
||||
out1 = conn.getresponse().read()
|
||||
assert_equal('"error":null' in out1, True)
|
||||
assert_equal(conn.sock!=None, False) #now the connection must be closed after the response
|
||||
|
||||
@@ -82,7 +82,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
conn = httplib.HTTPConnection(urlNode1.hostname, urlNode1.port)
|
||||
conn.connect()
|
||||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read();
|
||||
out1 = conn.getresponse().read()
|
||||
assert_equal('"error":null' in out1, True)
|
||||
|
||||
#node2 (third node) is running with standard keep-alive parameters which means keep-alive is on
|
||||
@@ -93,7 +93,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
conn = httplib.HTTPConnection(urlNode2.hostname, urlNode2.port)
|
||||
conn.connect()
|
||||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read();
|
||||
out1 = conn.getresponse().read()
|
||||
assert_equal('"error":null' in out1, True)
|
||||
assert_equal(conn.sock!=None, True) #connection must be closed because bitcoind should use keep-alive by default
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -6,10 +6,8 @@
|
||||
|
||||
from test_framework.test_framework import ComparisonTestFramework
|
||||
from test_framework.util import *
|
||||
from test_framework.comptool import TestManager, TestInstance
|
||||
from test_framework.mininode import *
|
||||
from test_framework.comptool import TestManager, TestInstance, RejectResult
|
||||
from test_framework.blocktools import *
|
||||
import logging
|
||||
import copy
|
||||
import time
|
||||
|
||||
@@ -97,7 +95,7 @@ class InvalidBlockRequestTest(ComparisonTestFramework):
|
||||
assert(block2_orig.vtx != block2.vtx)
|
||||
|
||||
self.tip = block2.sha256
|
||||
yield TestInstance([[block2, False], [block2_orig, True]])
|
||||
yield TestInstance([[block2, RejectResult(16,'bad-txns-duplicate')], [block2_orig, True]])
|
||||
height += 1
|
||||
|
||||
'''
|
||||
@@ -112,7 +110,7 @@ class InvalidBlockRequestTest(ComparisonTestFramework):
|
||||
block3.rehash()
|
||||
block3.solve()
|
||||
|
||||
yield TestInstance([[block3, False]])
|
||||
yield TestInstance([[block3, RejectResult(16,'bad-cb-amount')]])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
72
qa/rpc-tests/invalidtxrequest.py
Executable file
72
qa/rpc-tests/invalidtxrequest.py
Executable file
@@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env python2
|
||||
#
|
||||
# Distributed under the MIT/X11 software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
|
||||
from test_framework.test_framework import ComparisonTestFramework
|
||||
from test_framework.comptool import TestManager, TestInstance, RejectResult
|
||||
from test_framework.blocktools import *
|
||||
import time
|
||||
|
||||
|
||||
'''
|
||||
In this test we connect to one node over p2p, and test tx requests.
|
||||
'''
|
||||
|
||||
# Use the ComparisonTestFramework with 1 node: only use --testbinary.
|
||||
class InvalidTxRequestTest(ComparisonTestFramework):
|
||||
|
||||
''' Can either run this test as 1 node with expected answers, or two and compare them.
|
||||
Change the "outcome" variable from each TestInstance object to only do the comparison. '''
|
||||
def __init__(self):
|
||||
self.num_nodes = 1
|
||||
|
||||
def run_test(self):
|
||||
test = TestManager(self, self.options.tmpdir)
|
||||
test.add_all_connections(self.nodes)
|
||||
self.tip = None
|
||||
self.block_time = None
|
||||
NetworkThread().start() # Start up network handling in another thread
|
||||
test.run()
|
||||
|
||||
def get_tests(self):
|
||||
if self.tip is None:
|
||||
self.tip = int ("0x" + self.nodes[0].getbestblockhash() + "L", 0)
|
||||
self.block_time = int(time.time())+1
|
||||
|
||||
'''
|
||||
Create a new block with an anyone-can-spend coinbase
|
||||
'''
|
||||
height = 1
|
||||
block = create_block(self.tip, create_coinbase(height), self.block_time)
|
||||
self.block_time += 1
|
||||
block.solve()
|
||||
# Save the coinbase for later
|
||||
self.block1 = block
|
||||
self.tip = block.sha256
|
||||
height += 1
|
||||
yield TestInstance([[block, True]])
|
||||
|
||||
'''
|
||||
Now we need that block to mature so we can spend the coinbase.
|
||||
'''
|
||||
test = TestInstance(sync_every_block=False)
|
||||
for i in xrange(100):
|
||||
block = create_block(self.tip, create_coinbase(height), self.block_time)
|
||||
block.solve()
|
||||
self.tip = block.sha256
|
||||
self.block_time += 1
|
||||
test.blocks_and_transactions.append([block, True])
|
||||
height += 1
|
||||
yield test
|
||||
|
||||
# chr(100) is OP_NOTIF
|
||||
# Transaction will be rejected with code 16 (REJECT_INVALID)
|
||||
tx1 = create_transaction(self.block1.vtx[0], 0, chr(100), 50*100000000)
|
||||
yield TestInstance([[tx1, RejectResult(16, 'mandatory-script-verify-flag-failed')]])
|
||||
|
||||
# TODO: test further transactions...
|
||||
|
||||
if __name__ == '__main__':
|
||||
InvalidTxRequestTest().main()
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -7,7 +7,15 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
from test_framework.mininode import CTransaction
|
||||
import cStringIO
|
||||
import binascii
|
||||
|
||||
def txFromHex(hexstring):
|
||||
tx = CTransaction()
|
||||
f = cStringIO.StringIO(binascii.unhexlify(hexstring))
|
||||
tx.deserialize(f)
|
||||
return tx
|
||||
|
||||
def check_array_result(object_array, to_match, expected):
|
||||
"""
|
||||
@@ -103,6 +111,107 @@ class ListTransactionsTest(BitcoinTestFramework):
|
||||
{"category":"receive","amount":Decimal("0.1")},
|
||||
{"txid":txid, "account" : "watchonly"} )
|
||||
|
||||
self.run_rbf_opt_in_test()
|
||||
|
||||
# Check that the opt-in-rbf flag works properly, for sent and received
|
||||
# transactions.
|
||||
def run_rbf_opt_in_test(self):
|
||||
# Check whether a transaction signals opt-in RBF itself
|
||||
def is_opt_in(node, txid):
|
||||
rawtx = node.getrawtransaction(txid, 1)
|
||||
for x in rawtx["vin"]:
|
||||
if x["sequence"] < 0xfffffffe:
|
||||
return True
|
||||
return False
|
||||
|
||||
# Find an unconfirmed output matching a certain txid
|
||||
def get_unconfirmed_utxo_entry(node, txid_to_match):
|
||||
utxo = node.listunspent(0, 0)
|
||||
for i in utxo:
|
||||
if i["txid"] == txid_to_match:
|
||||
return i
|
||||
return None
|
||||
|
||||
# 1. Chain a few transactions that don't opt-in.
|
||||
txid_1 = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1)
|
||||
assert(not is_opt_in(self.nodes[0], txid_1))
|
||||
check_array_result(self.nodes[0].listtransactions(), {"txid": txid_1}, {"bip125-replaceable":"no"})
|
||||
sync_mempools(self.nodes)
|
||||
check_array_result(self.nodes[1].listtransactions(), {"txid": txid_1}, {"bip125-replaceable":"no"})
|
||||
|
||||
# Tx2 will build off txid_1, still not opting in to RBF.
|
||||
utxo_to_use = get_unconfirmed_utxo_entry(self.nodes[1], txid_1)
|
||||
|
||||
# Create tx2 using createrawtransaction
|
||||
inputs = [{"txid":utxo_to_use["txid"], "vout":utxo_to_use["vout"]}]
|
||||
outputs = {self.nodes[0].getnewaddress(): 0.999}
|
||||
tx2 = self.nodes[1].createrawtransaction(inputs, outputs)
|
||||
tx2_signed = self.nodes[1].signrawtransaction(tx2)["hex"]
|
||||
txid_2 = self.nodes[1].sendrawtransaction(tx2_signed)
|
||||
|
||||
# ...and check the result
|
||||
assert(not is_opt_in(self.nodes[1], txid_2))
|
||||
check_array_result(self.nodes[1].listtransactions(), {"txid": txid_2}, {"bip125-replaceable":"no"})
|
||||
sync_mempools(self.nodes)
|
||||
check_array_result(self.nodes[0].listtransactions(), {"txid": txid_2}, {"bip125-replaceable":"no"})
|
||||
|
||||
# Tx3 will opt-in to RBF
|
||||
utxo_to_use = get_unconfirmed_utxo_entry(self.nodes[0], txid_2)
|
||||
inputs = [{"txid": txid_2, "vout":utxo_to_use["vout"]}]
|
||||
outputs = {self.nodes[1].getnewaddress(): 0.998}
|
||||
tx3 = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
tx3_modified = txFromHex(tx3)
|
||||
tx3_modified.vin[0].nSequence = 0
|
||||
tx3 = binascii.hexlify(tx3_modified.serialize()).decode('utf-8')
|
||||
tx3_signed = self.nodes[0].signrawtransaction(tx3)['hex']
|
||||
txid_3 = self.nodes[0].sendrawtransaction(tx3_signed)
|
||||
|
||||
assert(is_opt_in(self.nodes[0], txid_3))
|
||||
check_array_result(self.nodes[0].listtransactions(), {"txid": txid_3}, {"bip125-replaceable":"yes"})
|
||||
sync_mempools(self.nodes)
|
||||
check_array_result(self.nodes[1].listtransactions(), {"txid": txid_3}, {"bip125-replaceable":"yes"})
|
||||
|
||||
# Tx4 will chain off tx3. Doesn't signal itself, but depends on one
|
||||
# that does.
|
||||
utxo_to_use = get_unconfirmed_utxo_entry(self.nodes[1], txid_3)
|
||||
inputs = [{"txid": txid_3, "vout":utxo_to_use["vout"]}]
|
||||
outputs = {self.nodes[0].getnewaddress(): 0.997}
|
||||
tx4 = self.nodes[1].createrawtransaction(inputs, outputs)
|
||||
tx4_signed = self.nodes[1].signrawtransaction(tx4)["hex"]
|
||||
txid_4 = self.nodes[1].sendrawtransaction(tx4_signed)
|
||||
|
||||
assert(not is_opt_in(self.nodes[1], txid_4))
|
||||
check_array_result(self.nodes[1].listtransactions(), {"txid": txid_4}, {"bip125-replaceable":"yes"})
|
||||
sync_mempools(self.nodes)
|
||||
check_array_result(self.nodes[0].listtransactions(), {"txid": txid_4}, {"bip125-replaceable":"yes"})
|
||||
|
||||
# Replace tx3, and check that tx4 becomes unknown
|
||||
tx3_b = tx3_modified
|
||||
tx3_b.vout[0].nValue -= 0.004*100000000 # bump the fee
|
||||
tx3_b = binascii.hexlify(tx3_b.serialize()).decode('utf-8')
|
||||
tx3_b_signed = self.nodes[0].signrawtransaction(tx3_b)['hex']
|
||||
txid_3b = self.nodes[0].sendrawtransaction(tx3_b_signed, True)
|
||||
assert(is_opt_in(self.nodes[0], txid_3b))
|
||||
|
||||
check_array_result(self.nodes[0].listtransactions(), {"txid": txid_4}, {"bip125-replaceable":"unknown"})
|
||||
sync_mempools(self.nodes)
|
||||
check_array_result(self.nodes[1].listtransactions(), {"txid": txid_4}, {"bip125-replaceable":"unknown"})
|
||||
|
||||
# Check gettransaction as well:
|
||||
for n in self.nodes[0:2]:
|
||||
assert_equal(n.gettransaction(txid_1)["bip125-replaceable"], "no")
|
||||
assert_equal(n.gettransaction(txid_2)["bip125-replaceable"], "no")
|
||||
assert_equal(n.gettransaction(txid_3)["bip125-replaceable"], "yes")
|
||||
assert_equal(n.gettransaction(txid_3b)["bip125-replaceable"], "yes")
|
||||
assert_equal(n.gettransaction(txid_4)["bip125-replaceable"], "unknown")
|
||||
|
||||
# After mining a transaction, it's no longer BIP125-replaceable
|
||||
self.nodes[0].generate(1)
|
||||
assert(txid_3b not in self.nodes[0].getrawmempool())
|
||||
assert_equal(self.nodes[0].gettransaction(txid_3b)["bip125-replaceable"], "no")
|
||||
assert_equal(self.nodes[0].gettransaction(txid_4)["bip125-replaceable"], "unknown")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
ListTransactionsTest().main()
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@ class TestManager(NodeConnCB):
|
||||
def __init__(self):
|
||||
NodeConnCB.__init__(self)
|
||||
self.log = logging.getLogger("BlockRelayTest")
|
||||
self.create_callback_map()
|
||||
|
||||
def add_new_connection(self, connection):
|
||||
self.connection = connection
|
||||
|
||||
@@ -25,7 +25,6 @@ if uploadtarget has been reached.
|
||||
class TestNode(NodeConnCB):
|
||||
def __init__(self):
|
||||
NodeConnCB.__init__(self)
|
||||
self.create_callback_map()
|
||||
self.connection = None
|
||||
self.ping_counter = 1
|
||||
self.last_pong = msg_pong()
|
||||
@@ -85,22 +84,7 @@ class TestNode(NodeConnCB):
|
||||
class MaxUploadTest(BitcoinTestFramework):
|
||||
def __init__(self):
|
||||
self.utxo = []
|
||||
|
||||
# Some pre-processing to create a bunch of OP_RETURN txouts to insert into transactions we create
|
||||
# So we have big transactions and full blocks to fill up our block files
|
||||
# create one script_pubkey
|
||||
script_pubkey = "6a4d0200" #OP_RETURN OP_PUSH2 512 bytes
|
||||
for i in xrange (512):
|
||||
script_pubkey = script_pubkey + "01"
|
||||
# concatenate 128 txouts of above script_pubkey which we'll insert before the txout for change
|
||||
self.txouts = "81"
|
||||
for k in xrange(128):
|
||||
# add txout value
|
||||
self.txouts = self.txouts + "0000000000000000"
|
||||
# add length of script_pubkey
|
||||
self.txouts = self.txouts + "fd0402"
|
||||
# add script_pubkey
|
||||
self.txouts = self.txouts + script_pubkey
|
||||
self.txouts = gen_return_txouts()
|
||||
|
||||
def add_options(self, parser):
|
||||
parser.add_option("--testbinary", dest="testbinary",
|
||||
|
||||
55
qa/rpc-tests/mempool_limit.py
Executable file
55
qa/rpc-tests/mempool_limit.py
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
# Test mempool limiting together/eviction with the wallet
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
class MempoolLimitTest(BitcoinTestFramework):
|
||||
|
||||
def __init__(self):
|
||||
self.txouts = gen_return_txouts()
|
||||
|
||||
def setup_network(self):
|
||||
self.nodes = []
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-maxmempool=5", "-spendzeroconfchange=0", "-debug"]))
|
||||
self.is_network_split = False
|
||||
self.sync_all()
|
||||
self.relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||
|
||||
def setup_chain(self):
|
||||
print("Initializing test directory "+self.options.tmpdir)
|
||||
initialize_chain_clean(self.options.tmpdir, 2)
|
||||
|
||||
def run_test(self):
|
||||
txids = []
|
||||
utxos = create_confirmed_utxos(self.relayfee, self.nodes[0], 90)
|
||||
|
||||
#create a mempool tx that will be evicted
|
||||
us0 = utxos.pop()
|
||||
inputs = [{ "txid" : us0["txid"], "vout" : us0["vout"]}]
|
||||
outputs = {self.nodes[0].getnewaddress() : 0.0001}
|
||||
tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
self.nodes[0].settxfee(self.relayfee) # specifically fund this tx with low fee
|
||||
txF = self.nodes[0].fundrawtransaction(tx)
|
||||
self.nodes[0].settxfee(0) # return to automatic fee selection
|
||||
txFS = self.nodes[0].signrawtransaction(txF['hex'])
|
||||
txid = self.nodes[0].sendrawtransaction(txFS['hex'])
|
||||
self.nodes[0].lockunspent(True, [us0])
|
||||
|
||||
relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||
base_fee = relayfee*100
|
||||
for i in xrange (4):
|
||||
txids.append([])
|
||||
txids[i] = create_lots_of_big_transactions(self.nodes[0], self.txouts, utxos[30*i:30*i+30], (i+1)*base_fee)
|
||||
|
||||
# by now, the tx should be evicted, check confirmation state
|
||||
assert(txid not in self.nodes[0].getrawmempool())
|
||||
txdata = self.nodes[0].gettransaction(txid)
|
||||
assert(txdata['confirmations'] == 0) #confirmation should still be 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
MempoolLimitTest().main()
|
||||
@@ -64,17 +64,50 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||
for x in reversed(chain):
|
||||
assert_equal(mempool[x]['descendantcount'], descendant_count)
|
||||
descendant_fees += mempool[x]['fee']
|
||||
assert_equal(mempool[x]['modifiedfee'], mempool[x]['fee'])
|
||||
assert_equal(mempool[x]['descendantfees'], SATOSHIS*descendant_fees)
|
||||
descendant_size += mempool[x]['size']
|
||||
assert_equal(mempool[x]['descendantsize'], descendant_size)
|
||||
descendant_count += 1
|
||||
|
||||
# Check that descendant modified fees includes fee deltas from
|
||||
# prioritisetransaction
|
||||
self.nodes[0].prioritisetransaction(chain[-1], 0, 1000)
|
||||
mempool = self.nodes[0].getrawmempool(True)
|
||||
|
||||
descendant_fees = 0
|
||||
for x in reversed(chain):
|
||||
descendant_fees += mempool[x]['fee']
|
||||
assert_equal(mempool[x]['descendantfees'], SATOSHIS*descendant_fees+1000)
|
||||
|
||||
# Adding one more transaction on to the chain should fail.
|
||||
try:
|
||||
self.chain_transaction(self.nodes[0], txid, vout, value, fee, 1)
|
||||
except JSONRPCException as e:
|
||||
print "too-long-ancestor-chain successfully rejected"
|
||||
|
||||
# Check that prioritising a tx before it's added to the mempool works
|
||||
# First clear the mempool by mining a block.
|
||||
self.nodes[0].generate(1)
|
||||
sync_blocks(self.nodes)
|
||||
assert_equal(len(self.nodes[0].getrawmempool()), 0)
|
||||
# Prioritise a transaction that has been mined, then add it back to the
|
||||
# mempool by using invalidateblock.
|
||||
self.nodes[0].prioritisetransaction(chain[-1], 0, 2000)
|
||||
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
|
||||
# Keep node1's tip synced with node0
|
||||
self.nodes[1].invalidateblock(self.nodes[1].getbestblockhash())
|
||||
|
||||
# Now check that the transaction is in the mempool, with the right modified fee
|
||||
mempool = self.nodes[0].getrawmempool(True)
|
||||
|
||||
descendant_fees = 0
|
||||
for x in reversed(chain):
|
||||
descendant_fees += mempool[x]['fee']
|
||||
if (x == chain[-1]):
|
||||
assert_equal(mempool[x]['modifiedfee'], mempool[x]['fee']+satoshi_round(0.00002))
|
||||
assert_equal(mempool[x]['descendantfees'], SATOSHIS*descendant_fees+2000)
|
||||
|
||||
# TODO: check that node1's mempool is as expected
|
||||
|
||||
# TODO: test ancestor size limits
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
# Create one-input, one-output, no-fee transaction:
|
||||
class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||
@@ -25,7 +23,7 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||
self.nodes.append(start_node(1, self.options.tmpdir, args))
|
||||
connect_nodes(self.nodes[1], 0)
|
||||
self.is_network_split = False
|
||||
self.sync_all
|
||||
self.sync_all()
|
||||
|
||||
def create_tx(self, from_txid, to_address, amount):
|
||||
inputs = [{ "txid" : from_txid, "vout" : 0}]
|
||||
@@ -87,11 +85,11 @@ class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||
|
||||
self.sync_all()
|
||||
|
||||
assert_equal(set(self.nodes[0].getrawmempool()), set([ spend_101_id, spend_102_1_id, timelock_tx_id ]))
|
||||
assert_equal(set(self.nodes[0].getrawmempool()), {spend_101_id, spend_102_1_id, timelock_tx_id})
|
||||
|
||||
for node in self.nodes:
|
||||
node.invalidateblock(last_block[0])
|
||||
assert_equal(set(self.nodes[0].getrawmempool()), set([ spend_101_id, spend_102_1_id, spend_103_1_id ]))
|
||||
assert_equal(set(self.nodes[0].getrawmempool()), {spend_101_id, spend_102_1_id, spend_103_1_id})
|
||||
|
||||
# Use invalidateblock to re-org back and make all those coinbase spends
|
||||
# immature/invalid:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
# Create one-input, one-output, no-fee transaction:
|
||||
class MempoolCoinbaseTest(BitcoinTestFramework):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
# Create one-input, one-output, no-fee transaction:
|
||||
class MempoolSpendCoinbaseTest(BitcoinTestFramework):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
class MerkleBlockTest(BitcoinTestFramework):
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import base64
|
||||
|
||||
try:
|
||||
import http.client as httplib
|
||||
@@ -54,7 +53,7 @@ class NodeHandlingTest (BitcoinTestFramework):
|
||||
self.nodes[2].setban("127.0.0.0/24", "add")
|
||||
self.nodes[2].setban("192.168.0.1", "add", 1) #ban for 1 seconds
|
||||
self.nodes[2].setban("2001:4d48:ac57:400:cacf:e9ff:fe1d:9c63/19", "add", 1000) #ban for 1000 seconds
|
||||
listBeforeShutdown = self.nodes[2].listbanned();
|
||||
listBeforeShutdown = self.nodes[2].listbanned()
|
||||
assert_equal("192.168.0.1/32", listBeforeShutdown[2]['address']) #must be here
|
||||
time.sleep(2) #make 100% sure we expired 192.168.0.1 node time
|
||||
|
||||
@@ -62,7 +61,7 @@ class NodeHandlingTest (BitcoinTestFramework):
|
||||
stop_node(self.nodes[2], 2)
|
||||
|
||||
self.nodes[2] = start_node(2, self.options.tmpdir)
|
||||
listAfterShutdown = self.nodes[2].listbanned();
|
||||
listAfterShutdown = self.nodes[2].listbanned()
|
||||
assert_equal("127.0.0.0/24", listAfterShutdown[0]['address'])
|
||||
assert_equal("127.0.0.0/32", listAfterShutdown[1]['address'])
|
||||
assert_equal("/19" in listAfterShutdown[2]['address'], True)
|
||||
|
||||
@@ -62,7 +62,6 @@ The test:
|
||||
class TestNode(NodeConnCB):
|
||||
def __init__(self):
|
||||
NodeConnCB.__init__(self)
|
||||
self.create_callback_map()
|
||||
self.connection = None
|
||||
self.ping_counter = 1
|
||||
self.last_pong = msg_pong()
|
||||
|
||||
@@ -7,15 +7,11 @@
|
||||
|
||||
from test_framework.test_framework import ComparisonTestFramework
|
||||
from test_framework.util import *
|
||||
from test_framework.comptool import TestManager, TestInstance
|
||||
from test_framework.mininode import *
|
||||
from test_framework.comptool import TestManager, TestInstance, RejectResult
|
||||
from test_framework.blocktools import *
|
||||
import logging
|
||||
import copy
|
||||
import time
|
||||
import numbers
|
||||
from test_framework.key import CECKey
|
||||
from test_framework.script import CScript, CScriptOp, SignatureHash, SIGHASH_ALL, OP_TRUE
|
||||
from test_framework.script import CScript, SignatureHash, SIGHASH_ALL, OP_TRUE, OP_FALSE
|
||||
|
||||
class PreviousSpendableOutput(object):
|
||||
def __init__(self, tx = CTransaction(), n = -1):
|
||||
@@ -122,13 +118,29 @@ class FullBlockTest(ComparisonTestFramework):
|
||||
return TestInstance([[self.tip, True]])
|
||||
|
||||
# returns a test case that asserts that the current tip was rejected
|
||||
def rejected():
|
||||
return TestInstance([[self.tip, False]])
|
||||
def rejected(reject = None):
|
||||
if reject is None:
|
||||
return TestInstance([[self.tip, False]])
|
||||
else:
|
||||
return TestInstance([[self.tip, reject]])
|
||||
|
||||
# move the tip back to a previous block
|
||||
def tip(number):
|
||||
self.tip = self.blocks[number]
|
||||
|
||||
# add transactions to a block produced by next_block
|
||||
def update_block(block_number, new_transactions):
|
||||
block = self.blocks[block_number]
|
||||
old_hash = block.sha256
|
||||
self.add_transactions_to_block(block, new_transactions)
|
||||
block.solve()
|
||||
# Update the internal state just like in next_block
|
||||
self.tip = block
|
||||
self.block_heights[block.sha256] = self.block_heights[old_hash]
|
||||
del self.block_heights[old_hash]
|
||||
self.blocks[block_number] = block
|
||||
return block
|
||||
|
||||
# creates a new block and advances the tip to that block
|
||||
block = self.next_block
|
||||
|
||||
@@ -141,14 +153,15 @@ class FullBlockTest(ComparisonTestFramework):
|
||||
|
||||
# Now we need that block to mature so we can spend the coinbase.
|
||||
test = TestInstance(sync_every_block=False)
|
||||
for i in range(100):
|
||||
for i in range(99):
|
||||
block(1000 + i)
|
||||
test.blocks_and_transactions.append([self.tip, True])
|
||||
save_spendable_output()
|
||||
yield test
|
||||
|
||||
|
||||
# Start by bulding a couple of blocks on top (which output is spent is in parentheses):
|
||||
# Start by building a couple of blocks on top (which output is spent is
|
||||
# in parentheses):
|
||||
# genesis -> b1 (0) -> b2 (1)
|
||||
out0 = get_spendable_output()
|
||||
block(1, spend=out0)
|
||||
@@ -156,8 +169,7 @@ class FullBlockTest(ComparisonTestFramework):
|
||||
yield accepted()
|
||||
|
||||
out1 = get_spendable_output()
|
||||
block(2, spend=out1)
|
||||
# Inv again, then deliver twice (shouldn't break anything).
|
||||
b2 = block(2, spend=out1)
|
||||
yield accepted()
|
||||
|
||||
|
||||
@@ -168,8 +180,8 @@ class FullBlockTest(ComparisonTestFramework):
|
||||
#
|
||||
# Nothing should happen at this point. We saw b2 first so it takes priority.
|
||||
tip(1)
|
||||
block(3, spend=out1)
|
||||
# Deliver twice (should still not break anything)
|
||||
b3 = block(3, spend=out1)
|
||||
txout_b3 = PreviousSpendableOutput(b3.vtx[1], 1)
|
||||
yield rejected()
|
||||
|
||||
|
||||
@@ -214,7 +226,7 @@ class FullBlockTest(ComparisonTestFramework):
|
||||
# \-> b3 (1) -> b4 (2)
|
||||
tip(6)
|
||||
block(9, spend=out4, additional_coinbase_value=1)
|
||||
yield rejected()
|
||||
yield rejected(RejectResult(16, 'bad-cb-amount'))
|
||||
|
||||
|
||||
# Create a fork that ends in a block with too much fee (the one that causes the reorg)
|
||||
@@ -226,7 +238,7 @@ class FullBlockTest(ComparisonTestFramework):
|
||||
yield rejected()
|
||||
|
||||
block(11, spend=out4, additional_coinbase_value=1)
|
||||
yield rejected()
|
||||
yield rejected(RejectResult(16, 'bad-cb-amount'))
|
||||
|
||||
|
||||
# Try again, but with a valid fork first
|
||||
@@ -252,6 +264,10 @@ class FullBlockTest(ComparisonTestFramework):
|
||||
|
||||
yield TestInstance([[b12, True, b13.sha256]]) # New tip should be b13.
|
||||
|
||||
# Add a block with MAX_BLOCK_SIGOPS and one with one more sigop
|
||||
# genesis -> b1 (0) -> b2 (1) -> b5 (2) -> b6 (3)
|
||||
# \-> b12 (3) -> b13 (4) -> b15 (5) -> b16 (6)
|
||||
# \-> b3 (1) -> b4 (2)
|
||||
|
||||
# Test that a block with a lot of checksigs is okay
|
||||
lots_of_checksigs = CScript([OP_CHECKSIG] * (1000000 / 50 - 1))
|
||||
@@ -264,8 +280,121 @@ class FullBlockTest(ComparisonTestFramework):
|
||||
out6 = get_spendable_output()
|
||||
too_many_checksigs = CScript([OP_CHECKSIG] * (1000000 / 50))
|
||||
block(16, spend=out6, script=too_many_checksigs)
|
||||
yield rejected(RejectResult(16, 'bad-blk-sigops'))
|
||||
|
||||
|
||||
# Attempt to spend a transaction created on a different fork
|
||||
# genesis -> b1 (0) -> b2 (1) -> b5 (2) -> b6 (3)
|
||||
# \-> b12 (3) -> b13 (4) -> b15 (5) -> b17 (b3.vtx[1])
|
||||
# \-> b3 (1) -> b4 (2)
|
||||
tip(15)
|
||||
block(17, spend=txout_b3)
|
||||
yield rejected(RejectResult(16, 'bad-txns-inputs-missingorspent'))
|
||||
|
||||
# Attempt to spend a transaction created on a different fork (on a fork this time)
|
||||
# genesis -> b1 (0) -> b2 (1) -> b5 (2) -> b6 (3)
|
||||
# \-> b12 (3) -> b13 (4) -> b15 (5)
|
||||
# \-> b18 (b3.vtx[1]) -> b19 (6)
|
||||
# \-> b3 (1) -> b4 (2)
|
||||
tip(13)
|
||||
block(18, spend=txout_b3)
|
||||
yield rejected()
|
||||
|
||||
block(19, spend=out6)
|
||||
yield rejected()
|
||||
|
||||
# Attempt to spend a coinbase at depth too low
|
||||
# genesis -> b1 (0) -> b2 (1) -> b5 (2) -> b6 (3)
|
||||
# \-> b12 (3) -> b13 (4) -> b15 (5) -> b20 (7)
|
||||
# \-> b3 (1) -> b4 (2)
|
||||
tip(15)
|
||||
out7 = get_spendable_output()
|
||||
block(20, spend=out7)
|
||||
yield rejected(RejectResult(16, 'bad-txns-premature-spend-of-coinbase'))
|
||||
|
||||
# Attempt to spend a coinbase at depth too low (on a fork this time)
|
||||
# genesis -> b1 (0) -> b2 (1) -> b5 (2) -> b6 (3)
|
||||
# \-> b12 (3) -> b13 (4) -> b15 (5)
|
||||
# \-> b21 (6) -> b22 (5)
|
||||
# \-> b3 (1) -> b4 (2)
|
||||
tip(13)
|
||||
block(21, spend=out6)
|
||||
yield rejected()
|
||||
|
||||
block(22, spend=out5)
|
||||
yield rejected()
|
||||
|
||||
# Create a block on either side of MAX_BLOCK_SIZE and make sure its accepted/rejected
|
||||
# genesis -> b1 (0) -> b2 (1) -> b5 (2) -> b6 (3)
|
||||
# \-> b12 (3) -> b13 (4) -> b15 (5) -> b23 (6)
|
||||
# \-> b24 (6) -> b25 (7)
|
||||
# \-> b3 (1) -> b4 (2)
|
||||
tip(15)
|
||||
b23 = block(23, spend=out6)
|
||||
old_hash = b23.sha256
|
||||
tx = CTransaction()
|
||||
script_length = MAX_BLOCK_SIZE - len(b23.serialize()) - 69
|
||||
script_output = CScript([chr(0)*script_length])
|
||||
tx.vout.append(CTxOut(0, script_output))
|
||||
tx.vin.append(CTxIn(COutPoint(b23.vtx[1].sha256, 1)))
|
||||
b23 = update_block(23, [tx])
|
||||
# Make sure the math above worked out to produce a max-sized block
|
||||
assert_equal(len(b23.serialize()), MAX_BLOCK_SIZE)
|
||||
yield accepted()
|
||||
|
||||
# Make the next block one byte bigger and check that it fails
|
||||
tip(15)
|
||||
b24 = block(24, spend=out6)
|
||||
script_length = MAX_BLOCK_SIZE - len(b24.serialize()) - 69
|
||||
script_output = CScript([chr(0)*(script_length+1)])
|
||||
tx.vout = [CTxOut(0, script_output)]
|
||||
b24 = update_block(24, [tx])
|
||||
assert_equal(len(b24.serialize()), MAX_BLOCK_SIZE+1)
|
||||
yield rejected(RejectResult(16, 'bad-blk-length'))
|
||||
|
||||
b25 = block(25, spend=out7)
|
||||
yield rejected()
|
||||
|
||||
# Create blocks with a coinbase input script size out of range
|
||||
# genesis -> b1 (0) -> b2 (1) -> b5 (2) -> b6 (3)
|
||||
# \-> b12 (3) -> b13 (4) -> b15 (5) -> b23 (6) -> b30 (7)
|
||||
# \-> ... (6) -> ... (7)
|
||||
# \-> b3 (1) -> b4 (2)
|
||||
tip(15)
|
||||
b26 = block(26, spend=out6)
|
||||
b26.vtx[0].vin[0].scriptSig = chr(0)
|
||||
b26.vtx[0].rehash()
|
||||
# update_block causes the merkle root to get updated, even with no new
|
||||
# transactions, and updates the required state.
|
||||
b26 = update_block(26, [])
|
||||
yield rejected(RejectResult(16, 'bad-cb-length'))
|
||||
|
||||
# Extend the b26 chain to make sure bitcoind isn't accepting b26
|
||||
b27 = block(27, spend=out7)
|
||||
yield rejected()
|
||||
|
||||
# Now try a too-large-coinbase script
|
||||
tip(15)
|
||||
b28 = block(28, spend=out6)
|
||||
b28.vtx[0].vin[0].scriptSig = chr(0)*101
|
||||
b28.vtx[0].rehash()
|
||||
b28 = update_block(28, [])
|
||||
yield rejected(RejectResult(16, 'bad-cb-length'))
|
||||
|
||||
# Extend the b28 chain to make sure bitcoind isn't accepted b28
|
||||
b29 = block(29, spend=out7)
|
||||
# TODO: Should get a reject message back with "bad-prevblk", except
|
||||
# there's a bug that prevents this from being detected. Just note
|
||||
# failure for now, and add the reject result later.
|
||||
yield rejected()
|
||||
|
||||
# b30 has a max-sized coinbase scriptSig.
|
||||
tip(23)
|
||||
b30 = block(30)
|
||||
b30.vtx[0].vin[0].scriptSig = chr(0)*100
|
||||
b30.vtx[0].rehash()
|
||||
b30 = update_block(30, [])
|
||||
yield accepted()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -15,21 +15,7 @@ COIN = 100000000
|
||||
class PrioritiseTransactionTest(BitcoinTestFramework):
|
||||
|
||||
def __init__(self):
|
||||
# Some pre-processing to create a bunch of OP_RETURN txouts to insert into transactions we create
|
||||
# So we have big transactions (and therefore can't fit very many into each block)
|
||||
# create one script_pubkey
|
||||
script_pubkey = "6a4d0200" #OP_RETURN OP_PUSH2 512 bytes
|
||||
for i in xrange (512):
|
||||
script_pubkey = script_pubkey + "01"
|
||||
# concatenate 128 txouts of above script_pubkey which we'll insert before the txout for change
|
||||
self.txouts = "81"
|
||||
for k in xrange(128):
|
||||
# add txout value
|
||||
self.txouts = self.txouts + "0000000000000000"
|
||||
# add length of script_pubkey
|
||||
self.txouts = self.txouts + "fd0402"
|
||||
# add script_pubkey
|
||||
self.txouts = self.txouts + script_pubkey
|
||||
self.txouts = gen_return_txouts()
|
||||
|
||||
def setup_chain(self):
|
||||
print("Initializing test directory "+self.options.tmpdir)
|
||||
@@ -42,62 +28,15 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug", "-printpriority=1"]))
|
||||
self.relayfee = self.nodes[0].getnetworkinfo()['relayfee']
|
||||
|
||||
def create_confirmed_utxos(self, count):
|
||||
self.nodes[0].generate(int(0.5*count)+101)
|
||||
utxos = self.nodes[0].listunspent()
|
||||
iterations = count - len(utxos)
|
||||
addr1 = self.nodes[0].getnewaddress()
|
||||
addr2 = self.nodes[0].getnewaddress()
|
||||
if iterations <= 0:
|
||||
return utxos
|
||||
for i in xrange(iterations):
|
||||
t = utxos.pop()
|
||||
fee = self.relayfee
|
||||
inputs = []
|
||||
inputs.append({ "txid" : t["txid"], "vout" : t["vout"]})
|
||||
outputs = {}
|
||||
send_value = t['amount'] - fee
|
||||
outputs[addr1] = satoshi_round(send_value/2)
|
||||
outputs[addr2] = satoshi_round(send_value/2)
|
||||
raw_tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
signed_tx = self.nodes[0].signrawtransaction(raw_tx)["hex"]
|
||||
txid = self.nodes[0].sendrawtransaction(signed_tx)
|
||||
|
||||
while (self.nodes[0].getmempoolinfo()['size'] > 0):
|
||||
self.nodes[0].generate(1)
|
||||
|
||||
utxos = self.nodes[0].listunspent()
|
||||
assert(len(utxos) >= count)
|
||||
return utxos
|
||||
|
||||
def create_lots_of_big_transactions(self, utxos, fee):
|
||||
addr = self.nodes[0].getnewaddress()
|
||||
txids = []
|
||||
for i in xrange(len(utxos)):
|
||||
t = utxos.pop()
|
||||
inputs = []
|
||||
inputs.append({ "txid" : t["txid"], "vout" : t["vout"]})
|
||||
outputs = {}
|
||||
send_value = t['amount'] - fee
|
||||
outputs[addr] = satoshi_round(send_value)
|
||||
rawtx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
newtx = rawtx[0:92]
|
||||
newtx = newtx + self.txouts
|
||||
newtx = newtx + rawtx[94:]
|
||||
signresult = self.nodes[0].signrawtransaction(newtx, None, None, "NONE")
|
||||
txid = self.nodes[0].sendrawtransaction(signresult["hex"], True)
|
||||
txids.append(txid)
|
||||
return txids
|
||||
|
||||
def run_test(self):
|
||||
utxos = self.create_confirmed_utxos(90)
|
||||
utxos = create_confirmed_utxos(self.relayfee, self.nodes[0], 90)
|
||||
base_fee = self.relayfee*100 # our transactions are smaller than 100kb
|
||||
txids = []
|
||||
|
||||
# Create 3 batches of transactions at 3 different fee rate levels
|
||||
for i in xrange(3):
|
||||
txids.append([])
|
||||
txids[i] = self.create_lots_of_big_transactions(utxos[30*i:30*i+30], (i+1)*base_fee)
|
||||
txids[i] = create_lots_of_big_transactions(self.nodes[0], self.txouts, utxos[30*i:30*i+30], (i+1)*base_fee)
|
||||
|
||||
# add a fee delta to something in the cheapest bucket and make sure it gets mined
|
||||
# also check that a different entry in the cheapest bucket is NOT mined (lower
|
||||
@@ -143,5 +82,45 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
|
||||
if (x != high_fee_tx):
|
||||
assert(x not in mempool)
|
||||
|
||||
# Create a free, low priority transaction. Should be rejected.
|
||||
utxo_list = self.nodes[0].listunspent()
|
||||
assert(len(utxo_list) > 0)
|
||||
utxo = utxo_list[0]
|
||||
|
||||
inputs = []
|
||||
outputs = {}
|
||||
inputs.append({"txid" : utxo["txid"], "vout" : utxo["vout"]})
|
||||
outputs[self.nodes[0].getnewaddress()] = utxo["amount"] - self.relayfee
|
||||
raw_tx = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
tx_hex = self.nodes[0].signrawtransaction(raw_tx)["hex"]
|
||||
txid = self.nodes[0].sendrawtransaction(tx_hex)
|
||||
|
||||
# A tx that spends an in-mempool tx has 0 priority, so we can use it to
|
||||
# test the effect of using prioritise transaction for mempool acceptance
|
||||
inputs = []
|
||||
inputs.append({"txid": txid, "vout": 0})
|
||||
outputs = {}
|
||||
outputs[self.nodes[0].getnewaddress()] = utxo["amount"] - self.relayfee
|
||||
raw_tx2 = self.nodes[0].createrawtransaction(inputs, outputs)
|
||||
tx2_hex = self.nodes[0].signrawtransaction(raw_tx2)["hex"]
|
||||
tx2_id = self.nodes[0].decoderawtransaction(tx2_hex)["txid"]
|
||||
|
||||
try:
|
||||
self.nodes[0].sendrawtransaction(tx2_hex)
|
||||
except JSONRPCException as exp:
|
||||
assert_equal(exp.error['code'], -26) # insufficient fee
|
||||
assert(tx2_id not in self.nodes[0].getrawmempool())
|
||||
else:
|
||||
assert(False)
|
||||
|
||||
# This is a less than 1000-byte transaction, so just set the fee
|
||||
# to be the minimum for a 1000 byte transaction and check that it is
|
||||
# accepted.
|
||||
self.nodes[0].prioritisetransaction(tx2_id, 0, int(self.relayfee*COIN))
|
||||
|
||||
print "Assert that prioritised free transaction is accepted to mempool"
|
||||
assert_equal(self.nodes[0].sendrawtransaction(tx2_hex), tx2_id)
|
||||
assert(tx2_id in self.nodes[0].getrawmempool())
|
||||
|
||||
if __name__ == '__main__':
|
||||
PrioritiseTransactionTest().main()
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
import socket
|
||||
import traceback, sys
|
||||
from binascii import hexlify
|
||||
import time, os
|
||||
|
||||
from test_framework.socks5 import Socks5Configuration, Socks5Command, Socks5Server, AddressType
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
@@ -34,7 +31,8 @@ addnode connect to onion
|
||||
addnode connect to generic DNS name
|
||||
'''
|
||||
|
||||
class ProxyTest(BitcoinTestFramework):
|
||||
|
||||
class ProxyTest(BitcoinTestFramework):
|
||||
def __init__(self):
|
||||
# Create two proxies on different ports
|
||||
# ... one unauthenticated
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os.path
|
||||
|
||||
def calc_usage(blockdir):
|
||||
return sum(os.path.getsize(blockdir+f) for f in os.listdir(blockdir) if os.path.isfile(blockdir+f))/(1024*1024)
|
||||
@@ -23,24 +22,7 @@ class PruneTest(BitcoinTestFramework):
|
||||
def __init__(self):
|
||||
self.utxo = []
|
||||
self.address = ["",""]
|
||||
|
||||
# Some pre-processing to create a bunch of OP_RETURN txouts to insert into transactions we create
|
||||
# So we have big transactions and full blocks to fill up our block files
|
||||
|
||||
# create one script_pubkey
|
||||
script_pubkey = "6a4d0200" #OP_RETURN OP_PUSH2 512 bytes
|
||||
for i in xrange (512):
|
||||
script_pubkey = script_pubkey + "01"
|
||||
# concatenate 128 txouts of above script_pubkey which we'll insert before the txout for change
|
||||
self.txouts = "81"
|
||||
for k in xrange(128):
|
||||
# add txout value
|
||||
self.txouts = self.txouts + "0000000000000000"
|
||||
# add length of script_pubkey
|
||||
self.txouts = self.txouts + "fd0402"
|
||||
# add script_pubkey
|
||||
self.txouts = self.txouts + script_pubkey
|
||||
|
||||
self.txouts = gen_return_txouts()
|
||||
|
||||
def setup_chain(self):
|
||||
print("Initializing test directory "+self.options.tmpdir)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
from pprint import pprint
|
||||
from time import sleep
|
||||
|
||||
# Create one-input, one-output, no-fee transaction:
|
||||
class RawTransactionsTest(BitcoinTestFramework):
|
||||
@@ -43,9 +41,9 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(101)
|
||||
self.sync_all()
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),1.5);
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),1.0);
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),5.0);
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),1.5)
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),1.0)
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),5.0)
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(5)
|
||||
self.sync_all()
|
||||
@@ -64,7 +62,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
except JSONRPCException,e:
|
||||
errorString = e.error['message']
|
||||
|
||||
assert_equal("Missing inputs" in errorString, True);
|
||||
assert("Missing inputs" in errorString)
|
||||
|
||||
#########################
|
||||
# RAW TX MULTISIG TESTS #
|
||||
@@ -83,7 +81,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
bal = self.nodes[2].getbalance()
|
||||
|
||||
# send 1.2 BTC to msig adr
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 1.2);
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 1.2)
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
@@ -105,7 +103,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
mSigObj = self.nodes[2].addmultisigaddress(2, [addr1Obj['pubkey'], addr2Obj['pubkey'], addr3Obj['pubkey']])
|
||||
mSigObjValid = self.nodes[2].validateaddress(mSigObj)
|
||||
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 2.2);
|
||||
txId = self.nodes[0].sendtoaddress(mSigObj, 2.2)
|
||||
decTx = self.nodes[0].gettransaction(txId)
|
||||
rawTx = self.nodes[0].decoderawtransaction(decTx['hex'])
|
||||
sPK = rawTx['vout'][0]['scriptPubKey']['hex']
|
||||
@@ -123,7 +121,7 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
for outpoint in rawTx['vout']:
|
||||
if outpoint['value'] == Decimal('2.20000000'):
|
||||
vout = outpoint
|
||||
break;
|
||||
break
|
||||
|
||||
bal = self.nodes[0].getbalance()
|
||||
inputs = [{ "txid" : txId, "vout" : vout['n'], "scriptPubKey" : vout['scriptPubKey']['hex']}]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import os.path
|
||||
|
||||
class ReindexTest(BitcoinTestFramework):
|
||||
|
||||
|
||||
@@ -54,8 +54,7 @@ def make_utxo(node, amount, confirmed=True, scriptPubKey=CScript([1])):
|
||||
tx2.vout = [CTxOut(amount, scriptPubKey)]
|
||||
tx2.rehash()
|
||||
|
||||
tx2_hex = binascii.hexlify(tx2.serialize()).decode('utf-8')
|
||||
#print tx2_hex
|
||||
binascii.hexlify(tx2.serialize()).decode('utf-8')
|
||||
|
||||
signed_tx = node.signrawtransaction(binascii.hexlify(tx2.serialize()).decode('utf-8'))
|
||||
|
||||
@@ -63,8 +62,14 @@ def make_utxo(node, amount, confirmed=True, scriptPubKey=CScript([1])):
|
||||
|
||||
# If requested, ensure txouts are confirmed.
|
||||
if confirmed:
|
||||
while len(node.getrawmempool()):
|
||||
mempool_size = len(node.getrawmempool())
|
||||
while mempool_size > 0:
|
||||
node.generate(1)
|
||||
new_size = len(node.getrawmempool())
|
||||
# Error out if we have something stuck in the mempool, as this
|
||||
# would likely be a bug.
|
||||
assert(new_size < mempool_size)
|
||||
mempool_size = new_size
|
||||
|
||||
return COutPoint(int(txid, 16), 0)
|
||||
|
||||
@@ -72,7 +77,7 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
||||
|
||||
def setup_network(self):
|
||||
self.nodes = []
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-maxorphantx=1000",
|
||||
self.nodes.append(start_node(0, self.options.tmpdir, ["-maxorphantx=1000", "-debug",
|
||||
"-relaypriority=0", "-whitelist=127.0.0.1",
|
||||
"-limitancestorcount=50",
|
||||
"-limitancestorsize=101",
|
||||
@@ -108,6 +113,9 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
||||
print "Running test opt-in..."
|
||||
self.test_opt_in()
|
||||
|
||||
print "Running test prioritised transactions..."
|
||||
self.test_prioritised_transactions()
|
||||
|
||||
print "Passed\n"
|
||||
|
||||
def test_simple_doublespend(self):
|
||||
@@ -513,5 +521,72 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
||||
# but make sure it is accepted anyway
|
||||
self.nodes[0].sendrawtransaction(tx3c_hex, True)
|
||||
|
||||
def test_prioritised_transactions(self):
|
||||
# Ensure that fee deltas used via prioritisetransaction are
|
||||
# correctly used by replacement logic
|
||||
|
||||
# 1. Check that feeperkb uses modified fees
|
||||
tx0_outpoint = make_utxo(self.nodes[0], 1.1*COIN)
|
||||
|
||||
tx1a = CTransaction()
|
||||
tx1a.vin = [CTxIn(tx0_outpoint, nSequence=0)]
|
||||
tx1a.vout = [CTxOut(1*COIN, CScript([b'a']))]
|
||||
tx1a_hex = txToHex(tx1a)
|
||||
tx1a_txid = self.nodes[0].sendrawtransaction(tx1a_hex, True)
|
||||
|
||||
# Higher fee, but the actual fee per KB is much lower.
|
||||
tx1b = CTransaction()
|
||||
tx1b.vin = [CTxIn(tx0_outpoint, nSequence=0)]
|
||||
tx1b.vout = [CTxOut(0.001*COIN, CScript([b'a'*740000]))]
|
||||
tx1b_hex = txToHex(tx1b)
|
||||
|
||||
# Verify tx1b cannot replace tx1a.
|
||||
try:
|
||||
tx1b_txid = self.nodes[0].sendrawtransaction(tx1b_hex, True)
|
||||
except JSONRPCException as exp:
|
||||
assert_equal(exp.error['code'], -26)
|
||||
else:
|
||||
assert(False)
|
||||
|
||||
# Use prioritisetransaction to set tx1a's fee to 0.
|
||||
self.nodes[0].prioritisetransaction(tx1a_txid, 0, int(-0.1*COIN))
|
||||
|
||||
# Now tx1b should be able to replace tx1a
|
||||
tx1b_txid = self.nodes[0].sendrawtransaction(tx1b_hex, True)
|
||||
|
||||
assert(tx1b_txid in self.nodes[0].getrawmempool())
|
||||
|
||||
# 2. Check that absolute fee checks use modified fee.
|
||||
tx1_outpoint = make_utxo(self.nodes[0], 1.1*COIN)
|
||||
|
||||
tx2a = CTransaction()
|
||||
tx2a.vin = [CTxIn(tx1_outpoint, nSequence=0)]
|
||||
tx2a.vout = [CTxOut(1*COIN, CScript([b'a']))]
|
||||
tx2a_hex = txToHex(tx2a)
|
||||
tx2a_txid = self.nodes[0].sendrawtransaction(tx2a_hex, True)
|
||||
|
||||
# Lower fee, but we'll prioritise it
|
||||
tx2b = CTransaction()
|
||||
tx2b.vin = [CTxIn(tx1_outpoint, nSequence=0)]
|
||||
tx2b.vout = [CTxOut(1.01*COIN, CScript([b'a']))]
|
||||
tx2b.rehash()
|
||||
tx2b_hex = txToHex(tx2b)
|
||||
|
||||
# Verify tx2b cannot replace tx2a.
|
||||
try:
|
||||
tx2b_txid = self.nodes[0].sendrawtransaction(tx2b_hex, True)
|
||||
except JSONRPCException as exp:
|
||||
assert_equal(exp.error['code'], -26)
|
||||
else:
|
||||
assert(False)
|
||||
|
||||
# Now prioritise tx2b to have a higher modified fee
|
||||
self.nodes[0].prioritisetransaction(tx2b.hash, 0, int(0.1*COIN))
|
||||
|
||||
# tx2b should now be accepted
|
||||
tx2b_txid = self.nodes[0].sendrawtransaction(tx2b_hex, True)
|
||||
|
||||
assert(tx2b_txid in self.nodes[0].getrawmempool())
|
||||
|
||||
if __name__ == '__main__':
|
||||
ReplaceByFeeTest().main()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -12,9 +12,7 @@ from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
from struct import *
|
||||
import binascii
|
||||
import json
|
||||
import StringIO
|
||||
import decimal
|
||||
|
||||
try:
|
||||
import http.client as httplib
|
||||
@@ -143,9 +141,9 @@ class RESTTest (BitcoinTestFramework):
|
||||
|
||||
binaryRequest = b'\x01\x02'
|
||||
binaryRequest += binascii.unhexlify(txid)
|
||||
binaryRequest += pack("i", n);
|
||||
binaryRequest += binascii.unhexlify(vintx);
|
||||
binaryRequest += pack("i", 0);
|
||||
binaryRequest += pack("i", n)
|
||||
binaryRequest += binascii.unhexlify(vintx)
|
||||
binaryRequest += pack("i", 0)
|
||||
|
||||
bin_response = http_post_call(url.hostname, url.port, '/rest/getutxos'+self.FORMAT_SEPARATOR+'bin', binaryRequest)
|
||||
output = StringIO.StringIO()
|
||||
@@ -206,7 +204,7 @@ class RESTTest (BitcoinTestFramework):
|
||||
json_request = '/checkmempool/'
|
||||
for x in range(0, 15):
|
||||
json_request += txid+'-'+str(n)+'/'
|
||||
json_request = json_request.rstrip("/");
|
||||
json_request = json_request.rstrip("/")
|
||||
response = http_post_call(url.hostname, url.port, '/rest/getutxos'+json_request+self.FORMAT_SEPARATOR+'json', '', True)
|
||||
assert_equal(response.status, 200) #must be a 500 because we exceeding the limits
|
||||
|
||||
@@ -254,7 +252,7 @@ class RESTTest (BitcoinTestFramework):
|
||||
response_header_json = http_get_call(url.hostname, url.port, '/rest/headers/1/'+bb_hash+self.FORMAT_SEPARATOR+"json", True)
|
||||
assert_equal(response_header_json.status, 200)
|
||||
response_header_json_str = response_header_json.read()
|
||||
json_obj = json.loads(response_header_json_str, parse_float=decimal.Decimal)
|
||||
json_obj = json.loads(response_header_json_str, parse_float=Decimal)
|
||||
assert_equal(len(json_obj), 1) #ensure that there is one header in the json response
|
||||
assert_equal(json_obj[0]['hash'], bb_hash) #request/response hash should be the same
|
||||
|
||||
@@ -282,7 +280,7 @@ class RESTTest (BitcoinTestFramework):
|
||||
assert_equal(len(json_obj), 5) #now we should have 5 header objects
|
||||
|
||||
# do tx test
|
||||
tx_hash = block_json_obj['tx'][0]['txid'];
|
||||
tx_hash = block_json_obj['tx'][0]['txid']
|
||||
json_string = http_get_call(url.hostname, url.port, '/rest/tx/'+tx_hash+self.FORMAT_SEPARATOR+"json")
|
||||
json_obj = json.loads(json_string)
|
||||
assert_equal(json_obj['txid'], tx_hash)
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
# Test for -rpcbind, as well as -rpcallowip and -rpcconnect
|
||||
|
||||
# Add python-bitcoinrpc to module search path:
|
||||
import os
|
||||
import sys
|
||||
# TODO extend this test from the test framework (like all other tests)
|
||||
|
||||
import json
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import traceback
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
from test_framework.mininode import *
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import time
|
||||
from test_framework.blocktools import create_block, create_coinbase
|
||||
|
||||
'''
|
||||
@@ -70,7 +69,6 @@ f. Announce 1 more header that builds on that fork.
|
||||
class BaseNode(NodeConnCB):
|
||||
def __init__(self):
|
||||
NodeConnCB.__init__(self)
|
||||
self.create_callback_map()
|
||||
self.connection = None
|
||||
self.last_inv = None
|
||||
self.last_headers = None
|
||||
@@ -221,18 +219,20 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
|
||||
# mine count blocks and return the new tip
|
||||
def mine_blocks(self, count):
|
||||
# Clear out last block announcement from each p2p listener
|
||||
[ x.clear_last_announcement() for x in self.p2p_connections ]
|
||||
self.nodes[0].generate(count)
|
||||
return int(self.nodes[0].getbestblockhash(), 16)
|
||||
|
||||
# mine a reorg that invalidates length blocks (replacing them with
|
||||
# length+1 blocks).
|
||||
# peers is the p2p nodes we're using; we clear their state after the
|
||||
# Note: we clear the state of our p2p connections after the
|
||||
# to-be-reorged-out blocks are mined, so that we don't break later tests.
|
||||
# return the list of block hashes newly mined
|
||||
def mine_reorg(self, length, peers):
|
||||
def mine_reorg(self, length):
|
||||
self.nodes[0].generate(length) # make sure all invalidated blocks are node0's
|
||||
sync_blocks(self.nodes, wait=0.1)
|
||||
[x.clear_last_announcement() for x in peers]
|
||||
[x.clear_last_announcement() for x in self.p2p_connections]
|
||||
|
||||
tip_height = self.nodes[1].getblockcount()
|
||||
hash_to_invalidate = self.nodes[1].getblockhash(tip_height-(length-1))
|
||||
@@ -246,6 +246,8 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
inv_node = InvNode()
|
||||
test_node = TestNode()
|
||||
|
||||
self.p2p_connections = [inv_node, test_node]
|
||||
|
||||
connections = []
|
||||
connections.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], inv_node))
|
||||
# Set nServices to 0 for test_node, so no block download will occur outside of
|
||||
@@ -304,7 +306,6 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
prev_tip = int(self.nodes[0].getbestblockhash(), 16)
|
||||
test_node.get_headers(locator=[prev_tip], hashstop=0L)
|
||||
test_node.sync_with_ping()
|
||||
test_node.clear_last_announcement() # Clear out empty headers response
|
||||
|
||||
# Now that we've synced headers, headers announcements should work
|
||||
tip = self.mine_blocks(1)
|
||||
@@ -353,8 +354,6 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
# broadcast it)
|
||||
assert_equal(inv_node.last_inv, None)
|
||||
assert_equal(inv_node.last_headers, None)
|
||||
inv_node.clear_last_announcement()
|
||||
test_node.clear_last_announcement()
|
||||
tip = self.mine_blocks(1)
|
||||
assert_equal(inv_node.check_last_announcement(inv=[tip]), True)
|
||||
assert_equal(test_node.check_last_announcement(headers=[tip]), True)
|
||||
@@ -369,7 +368,7 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
# getheaders or inv from peer.
|
||||
for j in xrange(2):
|
||||
# First try mining a reorg that can propagate with header announcement
|
||||
new_block_hashes = self.mine_reorg(length=7, peers=[test_node, inv_node])
|
||||
new_block_hashes = self.mine_reorg(length=7)
|
||||
tip = new_block_hashes[-1]
|
||||
assert_equal(inv_node.check_last_announcement(inv=[tip]), True)
|
||||
assert_equal(test_node.check_last_announcement(headers=new_block_hashes), True)
|
||||
@@ -377,7 +376,7 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
block_time += 8
|
||||
|
||||
# Mine a too-large reorg, which should be announced with a single inv
|
||||
new_block_hashes = self.mine_reorg(length=8, peers=[test_node, inv_node])
|
||||
new_block_hashes = self.mine_reorg(length=8)
|
||||
tip = new_block_hashes[-1]
|
||||
assert_equal(inv_node.check_last_announcement(inv=[tip]), True)
|
||||
assert_equal(test_node.check_last_announcement(inv=[tip]), True)
|
||||
@@ -389,7 +388,7 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
|
||||
# Use getblocks/getdata
|
||||
test_node.send_getblocks(locator = [fork_point])
|
||||
assert_equal(test_node.check_last_announcement(inv=new_block_hashes[0:-1]), True)
|
||||
assert_equal(test_node.check_last_announcement(inv=new_block_hashes), True)
|
||||
test_node.get_data(new_block_hashes)
|
||||
test_node.wait_for_block(new_block_hashes[-1])
|
||||
|
||||
@@ -408,7 +407,6 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
test_node.get_headers(locator=[fork_point], hashstop=new_block_hashes[1])
|
||||
test_node.get_data([tip])
|
||||
test_node.wait_for_block(tip)
|
||||
test_node.clear_last_announcement()
|
||||
elif i == 2:
|
||||
test_node.get_data([tip])
|
||||
test_node.wait_for_block(tip)
|
||||
@@ -446,7 +444,7 @@ class SendHeadersTest(BitcoinTestFramework):
|
||||
|
||||
inv_node.sync_with_ping() # Make sure blocks are processed
|
||||
test_node.last_getdata = None
|
||||
test_node.send_header_for_blocks(blocks);
|
||||
test_node.send_header_for_blocks(blocks)
|
||||
test_node.sync_with_ping()
|
||||
# should not have received any getdata messages
|
||||
with mininode_lock:
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#
|
||||
|
||||
from mininode import *
|
||||
from script import CScript, CScriptOp, OP_TRUE, OP_CHECKSIG
|
||||
from script import CScript, OP_TRUE, OP_CHECKSIG
|
||||
|
||||
# Create a block (with regtest difficulty)
|
||||
def create_block(hashprev, coinbase, nTime=None):
|
||||
|
||||
@@ -41,17 +41,32 @@ def wait_until(predicate, attempts=float('inf'), timeout=float('inf')):
|
||||
|
||||
return False
|
||||
|
||||
class RejectResult(object):
|
||||
'''
|
||||
Outcome that expects rejection of a transaction or block.
|
||||
'''
|
||||
def __init__(self, code, reason=''):
|
||||
self.code = code
|
||||
self.reason = reason
|
||||
def match(self, other):
|
||||
if self.code != other.code:
|
||||
return False
|
||||
return other.reason.startswith(self.reason)
|
||||
def __repr__(self):
|
||||
return '%i:%s' % (self.code,self.reason or '*')
|
||||
|
||||
class TestNode(NodeConnCB):
|
||||
|
||||
def __init__(self, block_store, tx_store):
|
||||
NodeConnCB.__init__(self)
|
||||
self.create_callback_map()
|
||||
self.conn = None
|
||||
self.bestblockhash = None
|
||||
self.block_store = block_store
|
||||
self.block_request_map = {}
|
||||
self.tx_store = tx_store
|
||||
self.tx_request_map = {}
|
||||
self.block_reject_map = {}
|
||||
self.tx_reject_map = {}
|
||||
|
||||
# When the pingmap is non-empty we're waiting for
|
||||
# a response
|
||||
@@ -95,6 +110,12 @@ class TestNode(NodeConnCB):
|
||||
except KeyError:
|
||||
raise AssertionError("Got pong for unknown ping [%s]" % repr(message))
|
||||
|
||||
def on_reject(self, conn, message):
|
||||
if message.message == 'tx':
|
||||
self.tx_reject_map[message.data] = RejectResult(message.code, message.reason)
|
||||
if message.message == 'block':
|
||||
self.block_reject_map[message.data] = RejectResult(message.code, message.reason)
|
||||
|
||||
def send_inv(self, obj):
|
||||
mtype = 2 if isinstance(obj, CBlock) else 1
|
||||
self.conn.send_message(msg_inv([CInv(mtype, obj.sha256)]))
|
||||
@@ -244,6 +265,15 @@ class TestManager(object):
|
||||
if outcome is None:
|
||||
if c.cb.bestblockhash != self.connections[0].cb.bestblockhash:
|
||||
return False
|
||||
elif isinstance(outcome, RejectResult): # Check that block was rejected w/ code
|
||||
if c.cb.bestblockhash == blockhash:
|
||||
return False
|
||||
if blockhash not in c.cb.block_reject_map:
|
||||
print 'Block not in reject map: %064x' % (blockhash)
|
||||
return False
|
||||
if not outcome.match(c.cb.block_reject_map[blockhash]):
|
||||
print 'Block rejected with %s instead of expected %s: %064x' % (c.cb.block_reject_map[blockhash], outcome, blockhash)
|
||||
return False
|
||||
elif ((c.cb.bestblockhash == blockhash) != outcome):
|
||||
# print c.cb.bestblockhash, blockhash, outcome
|
||||
return False
|
||||
@@ -263,6 +293,15 @@ class TestManager(object):
|
||||
if c.cb.lastInv != self.connections[0].cb.lastInv:
|
||||
# print c.rpc.getrawmempool()
|
||||
return False
|
||||
elif isinstance(outcome, RejectResult): # Check that tx was rejected w/ code
|
||||
if txhash in c.cb.lastInv:
|
||||
return False
|
||||
if txhash not in c.cb.tx_reject_map:
|
||||
print 'Tx not in reject map: %064x' % (txhash)
|
||||
return False
|
||||
if not outcome.match(c.cb.tx_reject_map[txhash]):
|
||||
print 'Tx rejected with %s instead of expected %s: %064x' % (c.cb.tx_reject_map[txhash], outcome, txhash)
|
||||
return False
|
||||
elif ((txhash in c.cb.lastInv) != outcome):
|
||||
# print c.rpc.getrawmempool(), c.cb.lastInv
|
||||
return False
|
||||
|
||||
@@ -36,6 +36,7 @@ MY_VERSION = 60001 # past bip-31 for ping/pong
|
||||
MY_SUBVERSION = "/python-mininode-tester:0.0.1/"
|
||||
|
||||
MAX_INV_SZ = 50000
|
||||
MAX_BLOCK_SIZE = 1000000
|
||||
|
||||
# Keep our own socket map for asyncore, so that we can track disconnects
|
||||
# ourselves (to workaround an issue with closing an asyncore socket when
|
||||
@@ -1003,6 +1004,18 @@ class msg_reject(object):
|
||||
class NodeConnCB(object):
|
||||
def __init__(self):
|
||||
self.verack_received = False
|
||||
# deliver_sleep_time is helpful for debugging race conditions in p2p
|
||||
# tests; it causes message delivery to sleep for the specified time
|
||||
# before acquiring the global lock and delivering the next message.
|
||||
self.deliver_sleep_time = None
|
||||
|
||||
def set_deliver_sleep_time(self, value):
|
||||
with mininode_lock:
|
||||
self.deliver_sleep_time = value
|
||||
|
||||
def get_deliver_sleep_time(self):
|
||||
with mininode_lock:
|
||||
return self.deliver_sleep_time
|
||||
|
||||
# Spin until verack message is received from the node.
|
||||
# Tests may want to use this as a signal that the test can begin.
|
||||
@@ -1015,32 +1028,13 @@ class NodeConnCB(object):
|
||||
return
|
||||
time.sleep(0.05)
|
||||
|
||||
# Derived classes should call this function once to set the message map
|
||||
# which associates the derived classes' functions to incoming messages
|
||||
def create_callback_map(self):
|
||||
self.cbmap = {
|
||||
"version": self.on_version,
|
||||
"verack": self.on_verack,
|
||||
"addr": self.on_addr,
|
||||
"alert": self.on_alert,
|
||||
"inv": self.on_inv,
|
||||
"getdata": self.on_getdata,
|
||||
"getblocks": self.on_getblocks,
|
||||
"tx": self.on_tx,
|
||||
"block": self.on_block,
|
||||
"getaddr": self.on_getaddr,
|
||||
"ping": self.on_ping,
|
||||
"pong": self.on_pong,
|
||||
"headers": self.on_headers,
|
||||
"getheaders": self.on_getheaders,
|
||||
"reject": self.on_reject,
|
||||
"mempool": self.on_mempool
|
||||
}
|
||||
|
||||
def deliver(self, conn, message):
|
||||
deliver_sleep = self.get_deliver_sleep_time()
|
||||
if deliver_sleep is not None:
|
||||
time.sleep(deliver_sleep)
|
||||
with mininode_lock:
|
||||
try:
|
||||
self.cbmap[message.command](conn, message)
|
||||
getattr(self, 'on_' + message.command)(conn, message)
|
||||
except:
|
||||
print "ERROR delivering %s (%s)" % (repr(message),
|
||||
sys.exc_info()[0])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ Functionality to build scripts, as well as SignatureHash().
|
||||
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
from test_framework.mininode import CTransaction, CTxOut, hash256
|
||||
from .mininode import CTransaction, CTxOut, hash256
|
||||
from binascii import hexlify
|
||||
|
||||
import sys
|
||||
bchr = chr
|
||||
@@ -24,10 +25,9 @@ if sys.version > '3':
|
||||
bchr = lambda x: bytes([x])
|
||||
bord = lambda x: x
|
||||
|
||||
import copy
|
||||
import struct
|
||||
|
||||
from test_framework.bignum import bn2vch
|
||||
from .bignum import bn2vch
|
||||
|
||||
MAX_SCRIPT_SIZE = 10000
|
||||
MAX_SCRIPT_ELEMENT_SIZE = 520
|
||||
@@ -226,7 +226,7 @@ OP_CHECKMULTISIGVERIFY = CScriptOp(0xaf)
|
||||
|
||||
# expansion
|
||||
OP_NOP1 = CScriptOp(0xb0)
|
||||
OP_NOP2 = CScriptOp(0xb1)
|
||||
OP_CHECKLOCKTIMEVERIFY = CScriptOp(0xb1)
|
||||
OP_NOP3 = CScriptOp(0xb2)
|
||||
OP_NOP4 = CScriptOp(0xb3)
|
||||
OP_NOP5 = CScriptOp(0xb4)
|
||||
@@ -353,7 +353,7 @@ VALID_OPCODES = {
|
||||
OP_CHECKMULTISIGVERIFY,
|
||||
|
||||
OP_NOP1,
|
||||
OP_NOP2,
|
||||
OP_CHECKLOCKTIMEVERIFY,
|
||||
OP_NOP3,
|
||||
OP_NOP4,
|
||||
OP_NOP5,
|
||||
@@ -472,7 +472,7 @@ OPCODE_NAMES.update({
|
||||
OP_CHECKMULTISIG : 'OP_CHECKMULTISIG',
|
||||
OP_CHECKMULTISIGVERIFY : 'OP_CHECKMULTISIGVERIFY',
|
||||
OP_NOP1 : 'OP_NOP1',
|
||||
OP_NOP2 : 'OP_NOP2',
|
||||
OP_CHECKLOCKTIMEVERIFY : 'OP_CHECKLOCKTIMEVERIFY',
|
||||
OP_NOP3 : 'OP_NOP3',
|
||||
OP_NOP4 : 'OP_NOP4',
|
||||
OP_NOP5 : 'OP_NOP5',
|
||||
@@ -591,7 +591,7 @@ OPCODES_BY_NAME = {
|
||||
'OP_CHECKMULTISIG' : OP_CHECKMULTISIG,
|
||||
'OP_CHECKMULTISIGVERIFY' : OP_CHECKMULTISIGVERIFY,
|
||||
'OP_NOP1' : OP_NOP1,
|
||||
'OP_NOP2' : OP_NOP2,
|
||||
'OP_CHECKLOCKTIMEVERIFY' : OP_CHECKLOCKTIMEVERIFY,
|
||||
'OP_NOP3' : OP_NOP3,
|
||||
'OP_NOP4' : OP_NOP4,
|
||||
'OP_NOP5' : OP_NOP5,
|
||||
@@ -777,7 +777,7 @@ class CScript(bytes):
|
||||
# need to change
|
||||
def _repr(o):
|
||||
if isinstance(o, bytes):
|
||||
return "x('%s')" % binascii.hexlify(o).decode('utf8')
|
||||
return "x('%s')" % hexlify(o).decode('utf8')
|
||||
else:
|
||||
return repr(o)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -120,7 +120,7 @@ class BitcoinTestFramework(object):
|
||||
if self.options.coveragedir:
|
||||
enable_coverage(self.options.coveragedir)
|
||||
|
||||
os.environ['PATH'] = self.options.srcdir+":"+os.environ['PATH']
|
||||
os.environ['PATH'] = self.options.srcdir+":"+self.options.srcdir+"/qt:"+os.environ['PATH']
|
||||
|
||||
check_json_precision()
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
#
|
||||
@@ -102,11 +102,12 @@ def initialize_datadir(dirname, n):
|
||||
if not os.path.isdir(datadir):
|
||||
os.makedirs(datadir)
|
||||
with open(os.path.join(datadir, "bitcoin.conf"), 'w') as f:
|
||||
f.write("regtest=1\n");
|
||||
f.write("rpcuser=rt\n");
|
||||
f.write("rpcpassword=rt\n");
|
||||
f.write("port="+str(p2p_port(n))+"\n");
|
||||
f.write("rpcport="+str(rpc_port(n))+"\n");
|
||||
f.write("regtest=1\n")
|
||||
f.write("rpcuser=rt\n")
|
||||
f.write("rpcpassword=rt\n")
|
||||
f.write("port="+str(p2p_port(n))+"\n")
|
||||
f.write("rpcport="+str(rpc_port(n))+"\n")
|
||||
f.write("listenonion=0\n")
|
||||
return datadir
|
||||
|
||||
def initialize_chain(test_dir):
|
||||
@@ -130,7 +131,7 @@ def initialize_chain(test_dir):
|
||||
# Create cache directories, run bitcoinds:
|
||||
for i in range(4):
|
||||
datadir=initialize_datadir("cache", i)
|
||||
args = [ os.getenv("BITCOIND", "bitcoind"), "-keypool=1", "-datadir="+datadir, "-discover=0" ]
|
||||
args = [ os.getenv("BITCOIND", "bitcoind"), "-server", "-keypool=1", "-datadir="+datadir, "-discover=0" ]
|
||||
if i > 0:
|
||||
args.append("-connect=127.0.0.1:"+str(p2p_port(0)))
|
||||
bitcoind_processes[i] = subprocess.Popen(args)
|
||||
@@ -218,7 +219,7 @@ def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=
|
||||
if binary is None:
|
||||
binary = os.getenv("BITCOIND", "bitcoind")
|
||||
# RPC tests still depend on free transactions
|
||||
args = [ binary, "-datadir="+datadir, "-keypool=1", "-discover=0", "-rest", "-blockprioritysize=50000" ]
|
||||
args = [ binary, "-datadir="+datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-blockprioritysize=50000" ]
|
||||
if extra_args is not None: args.extend(extra_args)
|
||||
bitcoind_processes[i] = subprocess.Popen(args)
|
||||
devnull = open(os.devnull, "w")
|
||||
@@ -406,5 +407,86 @@ def assert_raises(exc, fun, *args, **kwds):
|
||||
else:
|
||||
raise AssertionError("No exception raised")
|
||||
|
||||
def assert_is_hex_string(string):
|
||||
try:
|
||||
int(string, 16)
|
||||
except Exception as e:
|
||||
raise AssertionError(
|
||||
"Couldn't interpret %r as hexadecimal; raised: %s" % (string, e))
|
||||
|
||||
def assert_is_hash_string(string, length=64):
|
||||
if not isinstance(string, basestring):
|
||||
raise AssertionError("Expected a string, got type %r" % type(string))
|
||||
elif length and len(string) != length:
|
||||
raise AssertionError(
|
||||
"String of length %d expected; got %d" % (length, len(string)))
|
||||
elif not re.match('[abcdef0-9]+$', string):
|
||||
raise AssertionError(
|
||||
"String %r contains invalid characters for a hash." % string)
|
||||
|
||||
def satoshi_round(amount):
|
||||
return Decimal(amount).quantize(Decimal('0.00000001'), rounding=ROUND_DOWN)
|
||||
|
||||
def create_confirmed_utxos(fee, node, count):
|
||||
node.generate(int(0.5*count)+101)
|
||||
utxos = node.listunspent()
|
||||
iterations = count - len(utxos)
|
||||
addr1 = node.getnewaddress()
|
||||
addr2 = node.getnewaddress()
|
||||
if iterations <= 0:
|
||||
return utxos
|
||||
for i in xrange(iterations):
|
||||
t = utxos.pop()
|
||||
inputs = []
|
||||
inputs.append({ "txid" : t["txid"], "vout" : t["vout"]})
|
||||
outputs = {}
|
||||
send_value = t['amount'] - fee
|
||||
outputs[addr1] = satoshi_round(send_value/2)
|
||||
outputs[addr2] = satoshi_round(send_value/2)
|
||||
raw_tx = node.createrawtransaction(inputs, outputs)
|
||||
signed_tx = node.signrawtransaction(raw_tx)["hex"]
|
||||
txid = node.sendrawtransaction(signed_tx)
|
||||
|
||||
while (node.getmempoolinfo()['size'] > 0):
|
||||
node.generate(1)
|
||||
|
||||
utxos = node.listunspent()
|
||||
assert(len(utxos) >= count)
|
||||
return utxos
|
||||
|
||||
def gen_return_txouts():
|
||||
# Some pre-processing to create a bunch of OP_RETURN txouts to insert into transactions we create
|
||||
# So we have big transactions (and therefore can't fit very many into each block)
|
||||
# create one script_pubkey
|
||||
script_pubkey = "6a4d0200" #OP_RETURN OP_PUSH2 512 bytes
|
||||
for i in xrange (512):
|
||||
script_pubkey = script_pubkey + "01"
|
||||
# concatenate 128 txouts of above script_pubkey which we'll insert before the txout for change
|
||||
txouts = "81"
|
||||
for k in xrange(128):
|
||||
# add txout value
|
||||
txouts = txouts + "0000000000000000"
|
||||
# add length of script_pubkey
|
||||
txouts = txouts + "fd0402"
|
||||
# add script_pubkey
|
||||
txouts = txouts + script_pubkey
|
||||
return txouts
|
||||
|
||||
def create_lots_of_big_transactions(node, txouts, utxos, fee):
|
||||
addr = node.getnewaddress()
|
||||
txids = []
|
||||
for i in xrange(len(utxos)):
|
||||
t = utxos.pop()
|
||||
inputs = []
|
||||
inputs.append({ "txid" : t["txid"], "vout" : t["vout"]})
|
||||
outputs = {}
|
||||
send_value = t['amount'] - fee
|
||||
outputs[addr] = satoshi_round(send_value)
|
||||
rawtx = node.createrawtransaction(inputs, outputs)
|
||||
newtx = rawtx[0:92]
|
||||
newtx = newtx + txouts
|
||||
newtx = newtx + rawtx[94:]
|
||||
signresult = node.signrawtransaction(newtx, None, None, "NONE")
|
||||
txid = node.sendrawtransaction(signresult["hex"], True)
|
||||
txids.append(txid)
|
||||
return txids
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -8,11 +8,7 @@
|
||||
#
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.authproxy import AuthServiceProxy, JSONRPCException
|
||||
from decimal import Decimal
|
||||
from test_framework.util import *
|
||||
import os
|
||||
import shutil
|
||||
|
||||
class TxnMallTest(BitcoinTestFramework):
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -9,9 +9,6 @@
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
from decimal import Decimal
|
||||
import os
|
||||
import shutil
|
||||
|
||||
class TxnMallTest(BitcoinTestFramework):
|
||||
|
||||
|
||||
@@ -1,23 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#
|
||||
# Exercise the wallet. Ported from wallet.sh.
|
||||
# Does the following:
|
||||
# a) creates 3 nodes, with an empty chain (no blocks).
|
||||
# b) node0 mines a block
|
||||
# c) node1 mines 101 blocks, so now nodes 0 and 1 have 50btc, node2 has none.
|
||||
# d) node0 sends 21 btc to node2, in two transactions (11 btc, then 10 btc).
|
||||
# e) node0 mines a block, collects the fee on the second transaction
|
||||
# f) node1 mines 100 blocks, to mature node0's just-mined block
|
||||
# g) check that node0 has 100-21, node2 has 21
|
||||
# h) node0 should now have 2 unspent outputs; send these to node2 via raw tx broadcast by node1
|
||||
# i) have node1 mine a block
|
||||
# j) check balances - node0 should have 0, node2 should have 100
|
||||
# k) test ResendWalletTransactions - create transactions, startup fourth node, make sure it syncs
|
||||
#
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
@@ -160,7 +145,7 @@ class WalletTest (BitcoinTestFramework):
|
||||
sync_blocks(self.nodes)
|
||||
|
||||
relayed = self.nodes[0].resendwallettransactions()
|
||||
assert_equal(set(relayed), set([txid1, txid2]))
|
||||
assert_equal(set(relayed), {txid1, txid2})
|
||||
sync_mempools(self.nodes)
|
||||
|
||||
assert(txid1 in self.nodes[3].getrawmempool())
|
||||
@@ -190,7 +175,7 @@ class WalletTest (BitcoinTestFramework):
|
||||
for uTx in unspentTxs:
|
||||
if uTx['txid'] == zeroValueTxid:
|
||||
found = True
|
||||
assert_equal(uTx['amount'], Decimal('0.00000000'));
|
||||
assert_equal(uTx['amount'], Decimal('0'))
|
||||
assert(found)
|
||||
|
||||
#do some -walletbroadcast tests
|
||||
@@ -202,21 +187,22 @@ class WalletTest (BitcoinTestFramework):
|
||||
connect_nodes_bi(self.nodes,0,2)
|
||||
self.sync_all()
|
||||
|
||||
txIdNotBroadcasted = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 2);
|
||||
txIdNotBroadcasted = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 2)
|
||||
txObjNotBroadcasted = self.nodes[0].gettransaction(txIdNotBroadcasted)
|
||||
self.nodes[1].generate(1) #mine a block, tx should not be in there
|
||||
self.sync_all()
|
||||
assert_equal(self.nodes[2].getbalance(), node_2_bal); #should not be changed because tx was not broadcasted
|
||||
assert_equal(self.nodes[2].getbalance(), node_2_bal) #should not be changed because tx was not broadcasted
|
||||
|
||||
#now broadcast from another node, mine a block, sync, and check the balance
|
||||
self.nodes[1].sendrawtransaction(txObjNotBroadcasted['hex'])
|
||||
self.nodes[1].generate(1)
|
||||
self.sync_all()
|
||||
node_2_bal += 2
|
||||
txObjNotBroadcasted = self.nodes[0].gettransaction(txIdNotBroadcasted)
|
||||
assert_equal(self.nodes[2].getbalance(), node_2_bal + Decimal('2')); #should not be
|
||||
assert_equal(self.nodes[2].getbalance(), node_2_bal)
|
||||
|
||||
#create another tx
|
||||
txIdNotBroadcasted = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 2);
|
||||
txIdNotBroadcasted = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 2)
|
||||
|
||||
#restart the nodes with -walletbroadcast=1
|
||||
stop_nodes(self.nodes)
|
||||
@@ -229,23 +215,24 @@ class WalletTest (BitcoinTestFramework):
|
||||
|
||||
self.nodes[0].generate(1)
|
||||
sync_blocks(self.nodes)
|
||||
node_2_bal += 2
|
||||
|
||||
#tx should be added to balance because after restarting the nodes tx should be broadcastet
|
||||
assert_equal(self.nodes[2].getbalance(), node_2_bal + Decimal('4')); #should not be
|
||||
assert_equal(self.nodes[2].getbalance(), node_2_bal)
|
||||
|
||||
#send a tx with value in a string (PR#6380 +)
|
||||
txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "2")
|
||||
txObj = self.nodes[0].gettransaction(txId)
|
||||
assert_equal(txObj['amount'], Decimal('-2.00000000'))
|
||||
assert_equal(txObj['amount'], Decimal('-2'))
|
||||
|
||||
txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "0.0001")
|
||||
txObj = self.nodes[0].gettransaction(txId)
|
||||
assert_equal(txObj['amount'], Decimal('-0.00010000'))
|
||||
assert_equal(txObj['amount'], Decimal('-0.0001'))
|
||||
|
||||
#check if JSON parser can handle scientific notation in strings
|
||||
txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "1e-4")
|
||||
txObj = self.nodes[0].gettransaction(txId)
|
||||
assert_equal(txObj['amount'], Decimal('-0.00010000'))
|
||||
assert_equal(txObj['amount'], Decimal('-0.0001'))
|
||||
|
||||
#this should fail
|
||||
errorString = ""
|
||||
@@ -254,7 +241,7 @@ class WalletTest (BitcoinTestFramework):
|
||||
except JSONRPCException,e:
|
||||
errorString = e.error['message']
|
||||
|
||||
assert_equal("Invalid amount" in errorString, True);
|
||||
assert_equal("Invalid amount" in errorString, True)
|
||||
|
||||
errorString = ""
|
||||
try:
|
||||
@@ -262,7 +249,30 @@ class WalletTest (BitcoinTestFramework):
|
||||
except JSONRPCException,e:
|
||||
errorString = e.error['message']
|
||||
|
||||
assert_equal("not an integer" in errorString, True);
|
||||
assert_equal("not an integer" in errorString, True)
|
||||
|
||||
#check if wallet or blochchain maintenance changes the balance
|
||||
self.sync_all()
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
balance_nodes = [self.nodes[i].getbalance() for i in range(3)]
|
||||
|
||||
maintenance = [
|
||||
'-rescan',
|
||||
'-reindex',
|
||||
'-zapwallettxes=1',
|
||||
'-zapwallettxes=2',
|
||||
'-salvagewallet',
|
||||
]
|
||||
for m in maintenance:
|
||||
stop_nodes(self.nodes)
|
||||
wait_bitcoinds()
|
||||
self.nodes = start_nodes(3, self.options.tmpdir, [[m]] * 3)
|
||||
connect_nodes_bi(self.nodes,0,1)
|
||||
connect_nodes_bi(self.nodes,1,2)
|
||||
connect_nodes_bi(self.nodes,0,2)
|
||||
self.sync_all()
|
||||
assert_equal(balance_nodes, [self.nodes[i].getbalance() for i in range(3)])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python2
|
||||
# Copyright (c) 2014 The Bitcoin Core developers
|
||||
# Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
import zmq
|
||||
import binascii
|
||||
from test_framework.mininode import hash256
|
||||
|
||||
try:
|
||||
import http.client as httplib
|
||||
@@ -42,7 +41,7 @@ class ZMQTest (BitcoinTestFramework):
|
||||
def run_test(self):
|
||||
self.sync_all()
|
||||
|
||||
genhashes = self.nodes[0].generate(1);
|
||||
genhashes = self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
print "listen..."
|
||||
@@ -58,7 +57,7 @@ class ZMQTest (BitcoinTestFramework):
|
||||
assert_equal(genhashes[0], blkhash) #blockhash from generate must be equal to the hash received over zmq
|
||||
|
||||
n = 10
|
||||
genhashes = self.nodes[1].generate(n);
|
||||
genhashes = self.nodes[1].generate(n)
|
||||
self.sync_all()
|
||||
|
||||
zmqHashes = []
|
||||
@@ -76,7 +75,7 @@ class ZMQTest (BitcoinTestFramework):
|
||||
hashRPC = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1.0)
|
||||
self.sync_all()
|
||||
|
||||
#now we should receive a zmq msg because the tx was broadcastet
|
||||
# now we should receive a zmq msg because the tx was broadcast
|
||||
msg = self.zmqSubSocket.recv_multipart()
|
||||
topic = str(msg[0])
|
||||
body = msg[1]
|
||||
|
||||
@@ -7,7 +7,7 @@ SetCompressor /SOLID lzma
|
||||
!define REGKEY "SOFTWARE\$(^Name)"
|
||||
!define VERSION @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@
|
||||
!define COMPANY "Bitcoin Core project"
|
||||
!define URL http://www.bitcoin.org/
|
||||
!define URL https://bitcoincore.org/
|
||||
|
||||
# MUI Symbol Definitions
|
||||
!define MUI_ICON "@abs_top_srcdir@/share/pixmaps/bitcoin.ico"
|
||||
|
||||
@@ -117,12 +117,12 @@ BITCOIN_CORE_H = \
|
||||
memusage.h \
|
||||
merkleblock.h \
|
||||
miner.h \
|
||||
mruset.h \
|
||||
net.h \
|
||||
netbase.h \
|
||||
noui.h \
|
||||
policy/fees.h \
|
||||
policy/policy.h \
|
||||
policy/rbf.h \
|
||||
pow.h \
|
||||
prevector.h \
|
||||
primitives/block.h \
|
||||
@@ -240,6 +240,7 @@ libbitcoin_wallet_a_SOURCES = \
|
||||
wallet/wallet.cpp \
|
||||
wallet/wallet_ismine.cpp \
|
||||
wallet/walletdb.cpp \
|
||||
policy/rbf.cpp \
|
||||
$(BITCOIN_CORE_H)
|
||||
|
||||
# crypto primitives library
|
||||
|
||||
@@ -59,7 +59,6 @@ BITCOIN_TESTS =\
|
||||
test/mempool_tests.cpp \
|
||||
test/merkle_tests.cpp \
|
||||
test/miner_tests.cpp \
|
||||
test/mruset_tests.cpp \
|
||||
test/multisig_tests.cpp \
|
||||
test/netbase_tests.cpp \
|
||||
test/pmt_tests.cpp \
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@@ -138,7 +138,7 @@ bool CAlert::RelayTo(CNode* pnode) const
|
||||
AppliesToMe() ||
|
||||
GetAdjustedTime() < nRelayUntil)
|
||||
{
|
||||
pnode->PushMessage("alert", *this);
|
||||
pnode->PushMessage(NetMsgType::ALERT, *this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin developers
|
||||
// Copyright (c) 2009-2015 The Bitcoin developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2014-2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2009-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2012-2014 The Bitcoin Core developers
|
||||
// Copyright (c) 2012-2015 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user