Commit graph

134 commits

Author SHA1 Message Date
Pieter Wuille 45a1ec51b1 Merge pull request #2115 from forrestv/getblocktemplate_allfees
Provide fee data for all txs in RPC getblocktemplate response
2013-01-10 13:09:51 -08:00
Jeff Garzik ea9788517b test/util_tests.cpp: one more DateTimeStrFormat 'T' removal 2013-01-01 19:48:28 -05:00
Forrest Voight 03cac0bb8e changed CreateNewBlock to return a CBlockTemplate object, which includes per-tx fee and sigop count data 2012-12-19 16:12:58 -05:00
Pieter Wuille 33766c9557 Merge pull request #2096 from 94m3k1n9/fix-time-formats
Change timestamps to use ISO8601 formatting
2012-12-13 14:39:57 -08:00
Gavin Andresen d339da70e5 Merge pull request #1825 from roques/bignum2
Bignum2
2012-12-12 09:23:16 -08:00
Richard Schwab 303b0009dc Change timestamps to use ISO8601 formatting 2012-12-12 16:32:22 +01:00
Pieter Wuille 487db8a2b1 Make test_bitcoin run in a temp datadir 2012-11-29 22:09:16 +01:00
Pieter Wuille 99d0d0f356 Introduce script verification flags
These flags select features to be enabled/disabled during script
evaluation/checking, instead of several booleans passed along.
Currently these flags are defined:
* SCRIPT_VERIFY_P2SH: enable BIP16-style subscript evaluation
* SCRIPT_VERIFY_STRICTENC: enforce strict adherence to pubkey/sig encoding standards.
2012-11-15 23:00:16 +01:00
Pieter Wuille c7075c4b65 Fix tests after cache tweaks 2012-11-10 00:09:57 +01:00
Pieter Wuille 7fea484674 Add -reindex, to perform in-place reindexing of block chain files
Flushes the blktree/ and coins/ databases, and reindexes the
block chain files, as if their contents was loaded via -loadblock.

Based on earlier work by Jeff Garzik.
2012-11-09 01:06:32 +01:00
Gavin Andresen 03346a61b1 Add redeemScript to listunspent output and signrawtransaction input
signrawtransaction was unable to sign pay-to-script-hash inputs
when given the list of private keys to use. With this commit
you can provide the p2sh redemption script in the list of
inputs.
2012-10-29 13:34:35 -04:00
Gavin Andresen 2d43f88e1f Tests for raw transactions argument checking 2012-10-29 13:34:35 -04:00
Gavin Andresen c4d884e20e No need for test fixture now that multisig is enabled on main network. 2012-10-29 13:34:35 -04:00
Philip Kaufmann 729b180686 change blockchain -> block chain (spelling)
- Wiki says "block chain" is correct ;)
- remove some unneeded spaces I found in the source, while fixing the spelling
2012-10-21 21:32:25 +02:00
Pieter Wuille 4ca60bba5c Remove BDB block database support 2012-10-20 23:08:57 +02:00
Pieter Wuille e1bfbab802 Add LevelDB MemEnv support
Support LevelDB memory-backed environments, and use them in unit tests.
2012-10-20 23:08:57 +02:00
Pieter Wuille d979e6e36a Use singleton block tree database instance 2012-10-20 23:08:57 +02:00
Pieter Wuille 13c51f20f6 Direct CCoins references
To prevent excessive copying of CCoins in and out of the CCoinsView
implementations, introduce a GetCoins() function in CCoinsViewCache
with returns a direct reference. The block validation and connection
logic is updated to require caching CCoinsViews, and exploits the
GetCoins() function heavily.
2012-10-20 23:08:57 +02:00
Pieter Wuille 450cbb0944 Ultraprune
This switches bitcoin's transaction/block verification logic to use a
"coin database", which contains all unredeemed transaction output scripts,
amounts and heights.

The name ultraprune comes from the fact that instead of a full transaction
index, we only (need to) keep an index with unspent outputs. For now, the
blocks themselves are kept as usual, although they are only necessary for
serving, rescanning and reorganizing.

The basic datastructures are CCoins (representing the coins of a single
transaction), and CCoinsView (representing a state of the coins database).
There are several implementations for CCoinsView. A dummy, one backed by
the coins database (coins.dat), one backed by the memory pool, and one
that adds a cache on top of it. FetchInputs, ConnectInputs, ConnectBlock,
DisconnectBlock, ... now operate on a generic CCoinsView.

The block switching logic now builds a single cached CCoinsView with
changes to be committed to the database before any changes are made.
This means no uncommitted changes are ever read from the database, and
should ease the transition to another database layer which does not
support transactions (but does support atomic writes), like LevelDB.

For the getrawtransaction() RPC call, access to a txid-to-disk index
would be preferable. As this index is not necessary or even useful
for any other part of the implementation, it is not provided. Instead,
getrawtransaction() uses the coin database to find the block height,
and then scans that block to find the requested transaction. This is
slow, but should suffice for debug purposes.
2012-10-20 23:08:57 +02:00
Pieter Wuille 0fa593d0fb Compact serialization for amounts
Special serializer/deserializer for amount values. It is optimized for
values which have few non-zero digits in decimal representation. Most
amounts currently in the txout set take only 1 or 2 bytes to
represent.
2012-10-20 23:08:56 +02:00
Pieter Wuille 4d6144f97f Compact serialization for variable-length integers
Variable-length integers: bytes are a MSB base-128 encoding of the number.
The high bit in each byte signifies whether another digit follows. To make
the encoding is one-to-one, one is subtracted from all but the last digit.
Thus, the byte sequence a[] with length len, where all but the last byte
has bit 128 set, encodes the number:

  (a[len-1] & 0x7F) + sum(i=1..len-1, 128^i*((a[len-i-1] & 0x7F)+1))

Properties:
* Very small (0-127: 1 byte, 128-16511: 2 bytes, 16512-2113663: 3 bytes)
* Every integer has exactly one encoding
* Encoding does not depend on size of original integer type
2012-10-20 23:08:56 +02:00
Jeff Garzik dee0ee2ac9 Merge pull request #1742 from sipa/canonical
Check for canonical public keys and signatures
2012-10-20 10:56:04 -07:00
Wladimir J. van der Laan d6b13283d1 data-driven base58 CBitcoinAddress/CBitcoinSecret tests
Arbitrary numbers of test vectors can be generated using the script
`gen_base58_test_vectors.py`.
2012-10-01 04:57:26 +02:00
Pieter Wuille 58bc86e37f Check for canonical public keys and signatures
Only enabled inside tests for now.
2012-09-21 01:24:25 +02:00
Gavin Andresen 6cbae37667 Merge branch 'testdata' of git://github.com/TheBlueMatt/bitcoin 2012-09-18 19:22:40 -04:00
Gavin Andresen a0971337d0 Merge branch 'refactor_times' of git://github.com/luke-jr/bitcoin 2012-09-18 10:59:31 -04:00
Christian von Roques 6f0cecfc47 tests for SetCompact and GetCompact of CBigNum 2012-09-15 19:08:50 +02:00
Luke Dashjr da7b8c1260 Bugfix: Initialize CWallet::nOrderPosNext on an empty wallet, and save it in db 2012-09-08 04:55:36 +00:00
xanatos af8c050bff Wrong address added to collection in test
The wrong address is added to the collection. As was written a second copy of address1 was added (and so address2 was useless).
2012-09-07 16:04:39 +03:00
Matt Corallo 65786afb05 Add various tests for CTransaction::CheckTransaction() 2012-09-05 22:33:59 -04:00
Matt Corallo 1fcebc16c5 check tx.CheckTransaction for data-driven tx tests.
(and change so that only one case has to fail to make a tx_invalid
test correct)
2012-09-05 22:33:59 -04:00
Pieter Wuille af1c6b93b7 Merge pull request #1699 from laanwj/2012_08_securealloc
Handle locked pages more robustly (Fixes issue #1462)
2012-08-24 04:38:57 -07:00
Luke Dashjr 9c7722b7c5 Store a fixed order of transactions (and accounting) in the wallet
For backward compatibility, new accounting data is stored after a \0 in the comment string.
This way, old versions and third-party software should load and store them, but all actual use (listtransactions, for example) ignores it.
2012-08-23 18:18:20 +00:00
Wladimir J. van der Laan e95568b78d Handle locked pages more robustly (Fixes issue #1462)
Memory locks do not stack, that is, pages which have been locked several times by calls to mlock()
will be unlocked by a single call to munlock(). This can result in keying material ending up in swap when
those functions are used naively. In this commit a class "LockedPageManager" is added
that simulates stacking memory locks by keeping a counter per page.
2012-08-23 06:55:35 +02:00
Gavin Andresen f39ab4c8d0 Merge branch 'testdata' of git://github.com/TheBlueMatt/bitcoin 2012-08-21 13:58:24 -04:00
Pieter Wuille 143acc7672 Merge pull request #1687 from gavinandresen/quietunit
Suppress output when running unit tests.
2012-08-21 07:07:51 -07:00
Matt Corallo fc4743faa8 Add data-driven transaction tests. 2012-08-20 12:12:41 -04:00
Matt Corallo 336a0abbbb Add a few test cases to data-driven script tests. 2012-08-20 12:12:41 -04:00
Gavin Andresen 4d51be1cf3 Suppress output when running unit tests.
This does two things:
1) Now does not output to debug.log if -printtodebugger flag is passed
2) Unit tests set -printtodebugger so only test results are output to stdout

Note that -printtodebugger only actually prints to the debugger on Windows.
2012-08-20 11:33:20 -04:00
Gavin Andresen 3fcec0d4a0 Set block.nVersion to fix miner unit test 2012-08-20 10:46:07 -04:00
Matt Corallo 8555a3e3cc Remove useless non-cross-platform tests. 2012-08-17 12:40:09 -04:00
Philip Kaufmann efdcf94174 fix further spelling errors / remove a tab in the source 2012-08-02 10:09:29 +02:00
Luke Dashjr 3c726dd3c0 Bugfix: Use standard BTC unit in comments 2012-08-01 17:49:57 +00:00
Luke Dashjr 814efd6f1f Bugfix: Fix a variety of misspellings 2012-08-01 17:49:51 +00:00
Luke Dashjr 639b61d78e Tests for CreateNewBlock 2012-07-12 16:35:34 +00:00
Luke Dashjr 148e107da6 Run BDB disk-less for test_bitcoin 2012-07-11 04:26:44 +00:00
Gavin Andresen a2709fad7f Implement raw transaction RPC calls
Implement listunspent / getrawtransaction / createrawtransaction /
signrawtransaction, to support creation and
signing-on-multiple-device multisignature transactions.
2012-07-05 12:50:09 -04:00
fanquake 7790f391ab Fix a couple more typos 2012-06-30 17:05:28 +08:00
Gavin Andresen 1b71f82e38 Merge branch 'patch-3' of https://github.com/xanatos/bitcoin 2012-06-28 15:24:35 -04:00
Gavin Andresen 1282c8653e Checkpoint at block 185333 (and remove a couple of intermediate checkpoints) 2012-06-25 09:26:14 -04:00