Commit Graph

583 Commits

Author SHA1 Message Date
UdjinM6
785adad57e Slightly refactor/fix IS (#1153)
* slightly refactor IS:
- the only place where logic is changed: `ProcessTxLockVote()` - it should first try to find mn and fail if none was found and only then try to call `GetMasternodeRank()` (which is heavy)
- fixed few `cs_main`
- slightly optimized number of `tx.GetHash()` calls
- lots of `const` (fixed few related functions in main.cpp)
- few smaller fixes: iterators, log output, comments, etc
- use thread safe methods of mnodeman
- safety check in GetAverageUnknownVoteTime
2016-11-22 00:40:32 +04:00
UdjinM6
36c4b6dc2e Trivial refactoring/cleanup (#990) 2016-09-05 20:09:25 +04:00
UdjinM6
3b606b0c63 Merge #951: More block validation for governance (#951)
b6b6d6c Added nSuperblockStartBlock, adjusted testnet/regtest params

15a3c64 More for governance block checks, p1 (non-compilable):
    - add GetPaymentsLimit() and GetPaymentsTotalAmount()
    - IsValidBlockHeight() should check nSuperblockStartBlock
    - CSuperblock::IsValid should check payment limit and miner payout
    - no cs_main
    - slightly refactored related things

e8f9e5d More for governance checks, p2 (compilable):
    - IsBlockValueValid(), IsBlockPayeeValid() and FillBlockPayee() rewritten, no cs_main for them
    - CreateNewBlock adjusted, need more work on CBlockTemplate (see TODO)
    - moved (and simplified) IsBlockPayeeValid() call from CheckBlock() to ConnectBlock()

51434cf Add ability to calculate only superblock part of subsidy in GetBlockSubsidy()

aa74200 Fix GetPaymentsLimit()

f7b6234 braces and comment

ade8f64 more checks for IsValidBlockHeight()
2016-08-21 19:41:40 -06:00
UdjinM6
df854a5e19 Merge #940: Adjust block download timeouts to match Dash avg block time (bitcoin/4)
9320e5b Adjust block download timeouts to match Dash avg block time (bitcoin/4)
2016-08-12 07:57:20 +02:00
Evan Duffield
338b0ce934 Merge pull request #914 from UdjinM6/dashBitcore1
Merge Bitpay's version of Bitcoin Core (additional indexes)
2016-08-08 12:53:34 -07:00
UdjinM6
a73c31f3f0 Fix GetBlockHash - Currently it's doing the job already done by chainActive and it's off by 1 block 2016-08-07 01:04:15 +03:00
UdjinM6
d514ee7f9a Merge #922: Refactor/fix spork
42bdf42 Refactor/fix spork:
- move ProcessSpork, GetSporkValue, IsSporkActive, ExecuteSpork and mapSporksActive to CSporkManager
- move Sign, CheckSignature, Relay to CSporkMessage
- move ReprocessBlocks out of sporks to main.cpp / rename DisconnectBlocksAndReprocess to DisconnectBlocks
- rename SporkKey to SporkPubKey
- bugfix: only set strMasterPrivKey if spork signature produced by that key was verified successfully
- few log format changes, cleaned up includes
2016-07-30 13:04:27 +02:00
UdjinM6
48d0edcbdf Merge remote-tracking branch 'bitpay/0.12.1-bitcore' into dashBitcore1
Resolved Conflicts:
	.travis.yml (ignoring changes, leaving dash version)
	src/Makefile.am
	src/main.cpp
	src/main.h
	src/rpcclient.cpp
	src/rpcserver.cpp
	src/script/script.cpp
	src/script/script.h
2016-07-19 08:49:28 +03:00
Holger Schinzel
f4e4dd65e7 Tag 0.12.1 final
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEbBAABCgAGBQJXD/i3AAoJEHSBCwEjRsmmOHsH+L5eRpiPeLhrDYyBFbp9RFKU
 TztyoeKAM4llEPmk6vAawgSL8HNY4va6lbY84sDfvCdLJqCxVR7MyiuQ4AQPXG4R
 Ke5DJ/G/K4ngyqruCBsSh2RJdVDrbE3zCmjN5gxPxrNKpi+mXs//A6gjvfxn4U1F
 WZepN3FzNFcqFG/ndKxptMYZoIuiK9JIhK7V/ksFKRPlUhipa1jh5sIWvCeFjiLT
 Wt8wGlHPHDFsPJW1o7EWMTHRhNCVqYhMDU7GT6FixIJFRGANIGlwfIUuqqUt0sil
 7YWIwD/+ai3dfeODazauqJAOEBXjoWCkuXn9IN/VhtvHOFR6AZO2aljS9ks6Cw==
 =6vRi
 -----END PGP SIGNATURE-----

Merge bitcoin tag 'v0.12.1' into dash v0.12.1.x

Merging Bitcoin 0.12.1 into Dash 0.12.1.x
2016-07-04 11:20:16 +02:00
Braydon Fuller
55fa4798eb main: spentindex for the mempool 2016-06-02 12:15:59 -04:00
Braydon Fuller
16d35eb228 main: add amount and address to spentindex value 2016-06-02 12:15:38 -04:00
Braydon Fuller
94ea69a4d5 rpc: fix issue with querying txids by block heights 2016-06-02 12:15:37 -04:00
Braydon Fuller
e3d9207e5a main: add spentindex option 2016-06-02 12:15:37 -04:00
Braydon Fuller
1bd65a5c4b main: sort address index utxos by height 2016-06-02 12:15:14 -04:00
Braydon Fuller
d0483c9aa0 main: remove spent address utxo indexes 2016-06-02 12:15:14 -04:00
Braydon Fuller
0b42ba227a main: index unspent outputs by address 2016-06-02 12:15:14 -04:00
Braydon Fuller
cad092aebb main: get address deltas between range of block heights 2016-06-02 12:15:14 -04:00
Braydon Fuller
206882cd4b main: fixed bug with overlapping address index keys
There was a bug where the spending address index could have the same key
as the receiving address index if the input and output indexes matched. This lead
to the output always overwriting the input index leading to incorrect balances
with missing spent amounts. This patch separates the two so that they have unique
keys so balances will be correctly calculated.
2016-06-02 12:15:14 -04:00
Braydon Fuller
935ca8f832 main: add block timestamp index 2016-06-02 12:15:13 -04:00
Braydon Fuller
7959a19085 main: serialize height in BE for address index key
fixes a sorting issue when iterating over keys
2016-06-02 12:15:13 -04:00
Braydon Fuller
18ea599a71 main: index address index sorted by height 2016-06-02 12:15:13 -04:00
Braydon Fuller
9babc7ff9f main: start of address index
Adds a configuration option for addressindex to search for txids by address. Includes
an additional rpc method for getting the txids for an address.
2016-06-02 12:15:13 -04:00
Wladimir J. van der Laan
4c3a00d35c
Reduce block timeout to 10 minutes
Now that #7804 fixed the timeout handling, reduce the block timeout from
20 minutes to 10 minutes. 20 minutes is overkill.

Conflicts:
	src/main.h

Github-Pull: #7832
Rebased-From: 62b9a557fca2aa55803c336ffcceccc50ccf0c3e
2016-04-07 13:53:48 +02:00
Pieter Wuille
90f1d246d3
Track block download times per individual block
Currently, we're keeping a timeout for each requested block, starting
from when it is requested, with a correction factor for the number of
blocks in the queue.

That's unnecessarily complicated and inaccurate.

As peers process block requests in order, we can make the timeout for each
block start counting only when all previous ones have been received, and
have a correction based on the number of peers, rather than the total number
of blocks.

Conflicts:
	src/main.cpp
	src/main.h

Self check after the last peer is removed

Github-Pull: #7804
Rebased-From: 2d1d6581eca4508838cd339cc19c72efc42d6ea0 0e24bbf679c95784ed5514a6a1f2fbf99dd97725
2016-04-07 13:16:16 +02:00
Wladimir J. van der Laan
834aaef7bd
Merge #7543: [0.12] Backport BIP9, BIP68 and BIP112 with softfork
640666b [qa] rpc-tests: Properly use integers, floats (BtcDrak)
c270b62 Fix comments in tests (BtcDrak)
caf1381 Add bip68-sequence.py to extended rpc tests (BtcDrak)
26e9a05 Test of BIP9 fork activation of mtp, csv, sequence_lock (NicolasDorier)
3a99feb Add RPC test for BIP 68/112/113 soft fork. (Alex Morcos)
159ee3d Policy: allow transaction version 2 relay policy. (BtcDrak)
9713ed3 Soft fork logic for BIP68 (BtcDrak)
648be9b Soft fork logic for BIP113 (BtcDrak)
ee40924 Add CHECKSEQUENCEVERIFY softfork through BIP9 (Pieter Wuille)
6ff0b9f RPC test for BIP9 warning logic (Suhas Daftuar)
0710b30 Test versionbits deployments (Suhas Daftuar)
8ebc6f2 Add testing of ComputeBlockVersion (Suhas Daftuar)
0bdaacd Softfork status report in RPC (Pieter Wuille)
5f90d4e Versionbits tests (Pieter Wuille)
6f83cf2 BIP9 Implementation (Pieter Wuille)
ade85e1 Add LockPoints (Alex Morcos)
c8d309e Code style fix. (BtcDrak)
6170506 Separate CheckLockTime() and CheckSequence() logic (BtcDrak)
c0c5e09 BIP112: Implement CHECKSEQUENCEVERIFY (Mark Friedenbach)
197c376 fix sdaftuar's nits again (Alex Morcos)
0a79c04 Bug fix to RPC test (Alex Morcos)
0d09af7 Add RPC test exercising BIP68 (mempool only) (Suhas Daftuar)
15ba08c Implement SequenceLocks functions (Alex Morcos)
2016-04-04 13:08:29 +02:00
BtcDrak
c0fe2c9e03 Mark p2p alert system as deprecated.
Set default to off
This feature is removed entirely as of 0.13.0
2016-03-24 20:06:06 +00:00
Pieter Wuille
0bdaacd791 Softfork status report in RPC 2016-03-18 09:14:52 +00:00
Pieter Wuille
6f83cf2adb BIP9 Implementation
Inspired by former implementations by Eric Lombrozo and Rusty Russell, and
based on code by Jorge Timon.
2016-03-18 09:14:52 +00:00
Alex Morcos
ade85e126d Add LockPoints
Obtain LockPoints to store in CTxMemPoolEntry and during a reorg, evaluate whether they are still valid and if not, recalculate them.
2016-03-18 09:14:52 +00:00
Alex Morcos
197c3760ff fix sdaftuar's nits again
it boggles the mind why these nits can't be delivered on a more timely basis
2016-03-18 09:14:52 +00:00
Alex Morcos
15ba08c3b5 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-03-18 09:14:52 +00:00
UdjinM6
581312ff90 Fix default fees
Closes #708
2016-03-02 12:56:19 +01:00
UdjinM6
a4aef837bd Merge remote-tracking branch 'origin/v0.12.1.x' into mergebtc0.12 + fix 2016-02-16 03:17:25 +03:00
UdjinM6
832e7505dd Merge remote-tracking branch 'bitcoin/0.12' into mergebtc0.12
+ fix AcceptToMemoryPool fDryRun for mnb
2016-02-06 18:53:20 +03:00
UdjinM6
a5ac60b868 Merge remote-tracking branch 'bitcoin/0.12' into HEAD
+ merge fixes
+ keepass on evhttp
2016-02-06 16:48:04 +03:00
Evan Duffield
83f87b0f2d merged 2016-02-04 12:39:53 -07:00
Evan Duffield
eeb53b9682 Vastly faster syncing process / small budget system changes
- Syncing process is now event based, rather than timeout based. This means the system can tell when it's done with each step and moves on between phases much faster. In initial testing it seems to be about 10-15x faster and has synced everytime successfully.
- Please remove print debugging when the syncing system is proven to be debugged.
2016-02-04 12:29:09 -07:00
Wladimir J. van der Laan
c76bfff11e
Merge #7440: [0.12] Rename permitrbf to mempoolreplacement and provide minimal string-list forward compatibility
af9f564 release-notes: Update for replacebyfee->mempoolreplacement rename (Luke Dashjr)
4ad418b Rename replacebyfee=opt-in to mempoolreplacement=fee (Luke Dashjr)
b2287a7 release-notes: Update for permitrbf->replacebyfee rename (Luke Dashjr)
5f456a6 Simplify check for replacebyfee=opt-in (Luke Dashjr)
e8d19ab Accept replacebyfee=opt-in for turning on opt-in RBF (Luke Dashjr)
1205f87 Rename permitrbf to replacebyfee (Luke Dashjr)
2016-02-03 10:30:10 +01:00
Luke Dashjr
4ad418bc9b Rename replacebyfee=opt-in to mempoolreplacement=fee 2016-02-01 19:31:36 +00:00
Gregory Maxwell
86755bc85a
Add whitelistforcerelay to control forced relaying. [#7099 redux]
- Add whitelistforcerelay to control forced relaying.

Also renames whitelistalwaysrelay.

Nodes relay all transactions from whitelisted peers, this
 gets in the way of some useful reasons for whitelisting
 peers-- for example, bypassing bandwidth limitations.

The purpose of this forced relaying is for specialized gateway
 applications where a node is being used as a P2P connection
 filter and multiplexer, but where you don't want it getting
 in the way of (re-)broadcast.

This change makes it configurable with whitelistforcerelay.

- Blacklist -whitelistalwaysrelay; replaced by -whitelistrelay.

Github-Pull: #7439
Rebased-From: 325c725fb6205e38142914acb9ed1733d8482d46 89d113e02a83617b4e971c160d47551476dacc71
2016-02-01 14:15:40 +01:00
CryptoVote
3f4d5c4c7d Updates monetary variable int64_t types to CAmount.
Closes #677
2016-01-31 11:34:57 +01:00
Luke Dashjr
1205f87d36 Rename permitrbf to replacebyfee
"permit" is currently used to configure transaction filtering, whereas replacement is more to do with the memory pool state than the transaction itself.
2016-01-29 01:31:33 +00:00
Wladimir J. van der Laan
da83ecd454
Add option -permitrbf to set transaction replacement policy
Add a configuration option `-permitrbf` to set transaction replacement policy
for the mempool.

Enabling it will enable (opt-in) RBF, disabling it will refuse all
conflicting transactions.

Conflicts:
	src/init.cpp
	src/main.cpp
	src/main.h

Github-Pull: #7386
Rebased-From: b768108d9c0b83330572711aef1e569543130d5e
2016-01-21 12:38:52 +01:00
Luke Dashjr
5b144b7113 Merge branch bytespersigop 2016-01-09 17:02:35 +00:00
MarcoFalke
333e1eaeea
Bump copyright headers to 2015
- Bump copyright headers to 2015
- [devtools] Rewrite fix-copyright-headers.py
- [devtools] Use git pretty-format for year parsing

Github-Pull: #7205
Rebased-From: fa6ad855e9159b2247da4fa0054f32fa181499ab fa24439ff3d8ab5b9efaf66ef4dae6713b88cb35 fa71669452e57039e4270fd2b33a0e0e1635b813
2016-01-05 14:13:33 +01:00
Suhas Daftuar
12c469b236
[Mempool] Fix mempool limiting and replace-by-fee for PrioritiseTransaction
1) Fix mempool limiting for PrioritiseTransaction

Redo the feerate index to be based on mining score, rather than fee.

Update mempool_packages.py to test prioritisetransaction's effect on
package scores.

2) Update replace-by-fee logic to use fee deltas

3) Use fee deltas for determining mempool acceptance

4) Remove GetMinRelayFee

One test in AcceptToMemoryPool was to compare a transaction's fee
agains the value returned by GetMinRelayFee. This value was zero for
all small transactions.  For larger transactions (between
DEFAULT_BLOCK_PRIORITY_SIZE and MAX_STANDARD_TX_SIZE), this function
was preventing low fee transactions from ever being accepted.

With this function removed, we will now allow transactions in that range
with fees (including modifications via PrioritiseTransaction) below
the minRelayTxFee, provided that they have sufficient priority.

Github-Pull: #7062
Rebased-From: eb306664e786ae43d539fde66f0fbe2a3e89d910 9ef2a25603c9ec4e44c4f45c6a5d4e4386ec86d3 27fae3484cdb21b0d24face833b966fce5926be5 901b01d674031f9aca717deeb372bafa160a24af
2015-12-21 17:19:53 +01:00
Pieter Wuille
10b88be798
Replace trickle nodes with per-node/message Poisson delays
We used to have a trickle node, a node which was chosen in each iteration of
the send loop that was privileged and allowed to send out queued up non-time
critical messages. Since the removal of the fixed sleeps in the network code,
this resulted in fast and attackable treatment of such broadcasts.

This pull request changes the 3 remaining trickle use cases by random delays:
* Local address broadcast (while also removing the the wiping of the seen filter)
* Address relay
* Inv relay (for transactions; blocks are always relayed immediately)

The code is based on older commits by Patrick Strateman.

Github-Pull: #7125
Rebased-From: 5400ef6bcb9d243b2b21697775aa6491115420f3
2015-12-14 13:43:53 +01:00
Luke Dashjr
45b8e278fb -bytespersigop option to additionally limit sigops in transactions we relay and mine 2015-12-01 20:57:08 +00:00
Alex Morcos
5f12263302 Expose FormatStateMessage 2015-12-01 10:10:25 -05:00
Wladimir J. van der Laan
c0c08c7c68
Merge pull request #7141
aabc897 rpc: Don't translate warning messages (Wladimir J. van der Laan)
2015-12-01 13:21:16 +01:00