aboutsummaryrefslogtreecommitdiff
path: root/src/test/pmt_tests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Switch blocks to a constant-space Merkle root/branch algorithm.Pieter Wuille2015-11-271-1/+2
| | | | | | | | | | | This switches the Merkle tree logic for blocks to one that runs in constant (small) space. The old code is moved to tests, and a new test is added that for various combinations of block sizes, transaction positions to compute a branch for, and mutations: * Verifies that the old code and new code agree for the Merkle root. * Verifies that the old code and new code agree for the Merkle branch. * Verifies that the computed Merkle branch is valid. * Verifies that mutations don't change the Merkle root. * Verifies that mutations are correctly detected.
* Do not store Merkle branches in the wallet.Pieter Wuille2015-09-221-1/+1
| | | | | | | | | | Assume that when a wallet transaction has a valid block hash and transaction position in it, the transaction is actually there. We're already trusting wallet data in a much more fundamental way anyway. To prevent backward compatibility issues, a new record is used for storing the block locator in the wallet. Old wallets will see a wallet file synchronized up to the genesis block, and rescan automatically.
* tests: add a BasicTestingSetup and apply to all testsWladimir J. van der Laan2015-03-121-1/+2
| | | | | | | | Make sure that chainparams and logging is properly initialized. Doing this for every test may be overkill, but this initialization is so simple that that does not matter. This should fix the travis issues.
* tests: fix spurious windows test failures after 012598880cCory Fields2015-01-061-4/+6
| | | | | | | | | | | | | on rare occasions, rand() was returning duped values, causing duplicate transactions. BuildMerkleTree happily used these, but CPartialMerkleTree caught them and returned a null merkle root. Rather than taking changes with rand(), use the loop counter to guarantee unique values. At sipa's request, also remove the remaining uses of rand().
* Use arith_uint256 where necessaryWladimir J. van der Laan2015-01-051-3/+9
| | | | Also add conversion from/to uint256 where needed.
* Replace direct use of 0 with SetNull and IsNullWladimir J. van der Laan2015-01-051-3/+3
| | | | | | Replace x=0 with .SetNull(), x==0 with IsNull(), x!=0 with !IsNull(). Replace uses of uint256(0) with uint256().
* Merge pull request #5349Wladimir J. van der Laan2015-01-021-0/+11
|\ | | | | | | 0125988 Implement test for merkle tree malleability in CPartialMerkleTree (Pieter Wuille)
| * Implement test for merkle tree malleability in CPartialMerkleTreePieter Wuille2014-12-111-0/+11
| | | | | | | | | | | | This is a check that is mentioned in BIP 37, but never implemented in the reference code. As Bitcoin Core so far never decodes partial merkle trees, this is not a problem. But perhaps others use the code as a reference.
* | Remove references to X11 licenceMichael Ford2014-12-161-1/+1
|/
* Move CMerkleBlock and CPartialMerkleTree to their own fileMatt Corallo2014-12-051-1/+3
|
* Add CMutableTransaction and make CTransaction immutable.Pieter Wuille2014-06-211-2/+2
| | | | | In addition, introduce a cached hash inside CTransaction, to prevent recalculating it over and over again.
* Add licenses for tests and test dataWladimir J. van der Laan2014-03-181-1/+3
| | | | | | | | - Add license headers to source files (years based on commit dates) in `src/test` as well as `qa` - Add `README.md` to `src/test/data` specifying MIT license Fixes #3848
* Cleanup code using forward declarations.Brandon Dahler2013-11-101-2/+7
| | | | | | | | | Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
* Add CPartialMerkleTreePieter Wuille2013-01-161-0/+98
This adds a compact representation for a subset of a merkle tree's nodes.