Commit Graph

74 Commits

Author SHA1 Message Date
Dag Robole 72f00608d0 Replace traditional for with ranged for in primitives 2017-07-24 16:32:21 +02:00
Pieter Wuille 10b22e3141
Merge #10760: Avoid dereference-of-casted-pointer
0aadc11fd Avoid dereference-of-casted-pointer (Pieter Wuille)

Pull request description:

  And prefer a static_cast to the intended reference type.

Tree-SHA512: e83b20023a4dca6029b46f7040a8a6fd54e1b42112ec0c87c3c3b567ed641de97a9e2335b57a2efb075491f641e5b977bc226a474276bea0c3c3c71d8d6ac54d
2017-07-15 12:22:50 -07:00
Gregory Maxwell 3babbcb487 Remove confusing MAX_BLOCK_BASE_SIZE.
Some people keep thinking that MAX_BLOCK_BASE_SIZE is a separate
 size limit from the weight limit when it fact it is superfluous,
 and used in early tests before the witness data has been
 validated or just to compute worst case sizes.  The size checks
 that use it would not behave any differently consensus wise
 if they were eliminated completely.

Its correct value is not independently settable but is a function
 of the weight limit and weight formula.

This patch just eliminates it and uses the scale factor as
 required to compute the worse case constants.

It also moves the weight factor out of primitives into consensus,
 which is a more logical place for it.
2017-07-14 19:24:17 +00:00
Pieter Wuille 0aadc11fd8 Avoid dereference-of-casted-pointer 2017-07-07 10:45:31 -07:00
practicalswift 656dbd871a Perform member initialization in initialization lists where possible 2017-06-04 01:09:48 +02:00
Jorge Timón 330bb5a456
Consensus: Minimal way to move dust out of consensus 2017-05-03 17:55:52 +02:00
Marcos Mayorga 4fbae77929 Improved efficiency in COutPoint constructors 2017-04-28 09:33:34 +01:00
Wladimir J. van der Laan 30ff3a2fc9
Merge #9602: Remove coin age priority and free transactions - implementation
b421e6d Update example bitcoin.conf (Alex Morcos)
7d4e950 Allow setting minrelaytxfee to 0 (Alex Morcos)
359e8a0 [cleanup] Remove coin age priority completely. (Alex Morcos)
f9b9371 [rpc] Remove priorityDelta from prioritisetransaction (Alex Morcos)
49be7e1 [rpc] Remove priority information from mempool RPC calls (Alex Morcos)
0315888 [test] Remove priority from tests (Alex Morcos)
f838005 No longer allow "free" transactions (Alex Morcos)
ad727f4 [rpc] sendrawtransaction no longer bypasses minRelayTxFee (Alex Morcos)
fe282ac [cleanup] Remove estimatePriority and estimateSmartPriority (Alex Morcos)
400b151 [debug] Change -printpriority option (Alex Morcos)
272b25a [mining] Remove -blockprioritysize. (Alex Morcos)
12839cd [rpc] Remove estimatepriority and estimatesmartpriority. (Alex Morcos)
ddf58c7 wallet: Remove sendfree (MarcoFalke)

Tree-SHA512: a9a4499405923ce794ef18f9e334dbbd59dfc73a3dc2df6f85cc9c62af6f353ec2eed9c2d5e58e904f918d0d7ab738f403dd4939d9bc2276136864fe63710782
2017-03-07 19:30:23 +01:00
Alex Morcos 359e8a03d1 [cleanup] Remove coin age priority completely.
Remove GetPriority and ComputePriority.  Remove internal machinery for tracking priority in CTxMemPoolEntry.
2017-03-03 16:50:20 -05:00
Suhas Daftuar 02c57b521a Optimize GetWitnessHash() for non-segwit transactions 2017-03-03 13:33:42 -05:00
Wladimir J. van der Laan 869781c51c
Merge #9283: A few more CTransactionRef optimizations
91335ba Remove unused MakeTransactionRef overloads (Pieter Wuille)
6713f0f Make FillBlock consume txn_available to avoid shared_ptr copies (Pieter Wuille)
62607d7 Convert COrphanTx to keep a CTransactionRef (Pieter Wuille)
c44e4c4 Make AcceptToMemoryPool take CTransactionRef (Pieter Wuille)
2017-01-04 12:23:10 +01:00
isle2983 27765b6403 Increment MIT Licence copyright header year on files modified in 2016
Edited via:

$ contrib/devtools/copyright_header.py update .
2016-12-31 11:01:21 -07:00
Pieter Wuille 91335ba389 Remove unused MakeTransactionRef overloads 2016-12-21 18:18:28 -08:00
Wladimir J. van der Laan e8cfe1ee2d
Merge #8589: Inline CTxInWitness inside CTxIn
f6fb7ac Move CTxInWitness inside CTxIn (Pieter Wuille)
2016-12-21 14:04:06 +01:00
BtcDrak 1f0ca1ae1c
Bump default transaction version to 2 2016-12-08 20:11:27 +00:00
Pieter Wuille f6fb7acda4 Move CTxInWitness inside CTxIn 2016-12-04 23:47:12 -08:00
Pieter Wuille 81e3228fcb Make CTransaction actually immutable 2016-12-02 18:37:43 -08:00
Pieter Wuille b4e4ba475a Introduce convenience type CTransactionRef 2016-11-19 17:53:23 -08:00
Pieter Wuille 1662b437b3 Make CBlock::vtx a vector of shared_ptr<CTransaction> 2016-11-19 17:51:09 -08:00
Pieter Wuille da60506fc8 Add deserializing constructors to CTransaction and CMutableTransaction 2016-11-19 17:50:40 -08:00
Pieter Wuille 528472111b Get rid of nType and nVersion
Remove the nType and nVersion as parameters to all serialization methods
and functions. There is only one place where it's read and has an impact
(in CAddress), and even there it does not impact any of the recursively
invoked serializers.

Instead, the few places that need nType or nVersion are changed to read
it directly from the stream object, through GetType() and GetVersion()
methods which are added to all stream classes.
2016-11-07 13:56:27 -08:00
Pieter Wuille 657e05ab2e Make GetSerializeSize a wrapper on top of CSizeComputer
Given that in default GetSerializeSize implementations created by
ADD_SERIALIZE_METHODS we're already using CSizeComputer(), get rid
of the specialized GetSerializeSize methods everywhere, and just use
CSizeComputer. This removes a lot of code which isn't actually used
anywhere.

For CCompactSize and CVarInt this actually removes a more efficient
size computing algorithm, which is brought back in a later commit.
2016-11-07 13:56:22 -08:00
Matt Corallo 190fd321ad Remove unused CTxOut::GetHash() 2016-11-04 10:50:43 -04:00
Hampus Sjöberg fdf82fba31 Adding method GetTotalSize() to CTransaction
GetTotalSize() returns the total transaction size (including witness) in
bytes.
2016-09-06 22:30:30 +02:00
MarcoFalke fa785d1211 Use __func__ to get function name for output printing 2016-08-19 18:59:00 +02:00
Wladimir J. van der Laan 806b9e7570
Merge #8332: semi trivial: clarify witness branches in transaction.h serialization
e37b16a transaction: clarify witness branches (Daniel Cousens)
2016-07-28 13:00:02 +02:00
Suhas Daftuar 2c06bae39e Rename "block cost" to "block weight" 2016-07-18 13:28:26 -04:00
Daniel Cousens e37b16a75c transaction: clarify witness branches 2016-07-14 13:40:50 +10:00
Bob McElrath 36ae37a9f9 Rename CTxinWitness -> CTxInWitness 2016-07-06 19:46:46 -04:00
Pieter Wuille 2b1f6f9ccf BIP141: Other consensus critical limits, and BIP145
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
2016-06-22 15:43:00 +02:00
Pieter Wuille 8b49040854 BIP141: Commitment structure and deployment
Includes a fix by Suhas Daftuar and LongShao007
2016-06-22 15:42:59 +02:00
Pieter Wuille 7030d9eb47 BIP144: Serialization, hashes, relay (sender side)
Contains refactorings by Eric Lombrozo.
Contains fixup by Nicolas Dorier.
Contains cleanup of CInv::GetCommand by Alex Morcos
2016-06-22 15:42:59 +02:00
Wladimir J. van der Laan 3081fb9a31
Merge #7763: Put hex-encoded version in UpdateTip
eff736e Reformat version in UpdateTip and other messages (Pieter Wuille)
2016-03-31 13:24:50 +02:00
Pieter Wuille eff736e55e Reformat version in UpdateTip and other messages
Also remove the hardly-readable nBits from UpdateTip's log message.
2016-03-31 12:28:34 +02:00
Wladimir J. van der Laan e8a8f3d4b2
Merge #7648: BIP9 versionbits softfork for BIP68, BIP112 and BIP113
71527a0 Test of BIP9 fork activation of mtp, csv, sequence_lock (NicolasDorier)
19d73d5 Add RPC test for BIP 68/112/113 soft fork. (Alex Morcos)
12c89c9 Policy: allow transaction version 2 relay policy. (BtcDrak)
02c2435 Soft fork logic for BIP68 (BtcDrak)
478fba6 Soft fork logic for BIP113 (BtcDrak)
65751a3 Add CHECKSEQUENCEVERIFY softfork through BIP9 (Pieter Wuille)
2016-03-30 18:59:39 +02:00
Wladimir J. van der Laan 3c27067dd2
Merge #7712: Improve COutPoint less operator
0f17692 Improve COutPoint less operator (João Barbosa)
2016-03-21 12:50:47 +01:00
BtcDrak 12c89c9185 Policy: allow transaction version 2 relay policy.
This commit introduces a way to gracefully bump the default
transaction version in a two step process.
2016-03-18 08:09:06 +00:00
João Barbosa 0f176927f8 Improve COutPoint less operator 2016-03-18 08:03:55 +00:00
Pieter Wuille 6851107b3a BIP9 Implementation
Inspired by former implementations by Eric Lombrozo and Rusty Russell, and
based on code by Jorge Timon.
2016-03-15 16:54:38 +01:00
Wladimir J. van der Laan 80d1f2e483
Merge #7184: Implement SequenceLocks functions for BIP 68
b043c4b fix sdaftuar's nits again (Alex Morcos)
a51c79b Bug fix to RPC test (Alex Morcos)
da6ad5f Add RPC test exercising BIP68 (mempool only) (Suhas Daftuar)
c6c2f0f Implement SequenceLocks functions (Alex Morcos)
2016-02-12 17:03:46 +01:00
Alex Morcos c6c2f0fd78 Implement SequenceLocks functions
SequenceLocks functions are used to evaluate sequence lock times or heights per BIP 68.

The majority of this code is copied from maaku in #6312
Further credit: btcdrak, sipa, NicolasDorier
2016-02-10 15:35:33 -05:00
MarcoFalke fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01:00
Wladimir J. van der Laan 327291af02
Merge pull request #6914
114b581 Prevector type (Pieter Wuille)
2015-12-01 10:22:14 +01:00
Pieter Wuille eece63fa72 Switch blocks to a constant-space Merkle root/branch algorithm.
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.
2015-11-27 15:36:52 +01:00
Pieter Wuille 114b5812f6 Prevector type 2015-11-13 18:15:20 +01:00
MarcoFalke 5f46a7d068 transaction_tests: Be more strict checking dust
* Don't allow off-by-one or more
* Make clear dust is coupled with minRelayTxFee
* Check rounding for odd values
2015-11-09 21:00:16 +01:00
Peter Todd 287f54fc90 Add CHECKLOCKTIMEVERIFY (BIP65) soft-fork logic
Based on the earlier BIP66 soft-fork logic implemented by Pieter
Wuille's 5a47811da5
2015-10-08 17:23:22 +02:00
Wladimir J. van der Laan 48efbdbe98
Merge pull request #5264
af3208b Resolve issue 3166. These changes decode valid SIGHASH types on signatures in assembly (asm) representations of scriptSig scripts. This squashed commit incorporates substantial helpful feedback from jtimon, laanwj, and sipa. (mruddy)
2015-09-25 19:19:07 +02:00
Pieter Wuille 3b33ec85ed Avoid duplicate CheckBlock checks 2015-09-22 18:51:08 +02:00
Pieter Wuille 391dff16fe Do not store Merkle branches in the wallet.
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.
2015-09-22 18:51:07 +02:00