Commit graph

1331 commits

Author SHA1 Message Date
BtcDrak 01fdfeffc4 Remove -alerts option 2016-03-18 19:33:59 +00:00
BtcDrak 92066344fd Update alert notification and GUI 2016-03-18 19:33:59 +00:00
BtcDrak bbb9d1d123 Remove p2p alert handling 2016-03-18 19:33:59 +00:00
BtcDrak 02c2435802 Soft fork logic for BIP68 2016-03-18 08:09:06 +00:00
BtcDrak 478fba6d52 Soft fork logic for BIP113 2016-03-18 08:09:06 +00:00
Pieter Wuille 65751a3cf2 Add CHECKSEQUENCEVERIFY softfork through BIP9 2016-03-18 08:09:06 +00:00
Wladimir J. van der Laan 73b7eb501e
Merge #7575: Minimal BIP9 implementation
8c74ced RPC test for BIP9 warning logic (Suhas Daftuar)
7870deb Test versionbits deployments (Suhas Daftuar)
532cbb2 Add testing of ComputeBlockVersion (Suhas Daftuar)
d23f6c6 Softfork status report in RPC (Pieter Wuille)
732e774 Versionbits tests (Pieter Wuille)
6851107 BIP9 Implementation (Pieter Wuille)
2016-03-18 08:50:43 +01:00
Wladimir J. van der Laan 01f4267623
Merge #7594: Mempool: Add tracking of ancestor packages
ce019bf Check all ancestor state in CTxMemPool::check() (Suhas Daftuar)
e2eeb5d Add ancestor feerate index to mempool (Suhas Daftuar)
72abd2c Add ancestor tracking to mempool (Suhas Daftuar)
76a7632 Remove work limit in UpdateForDescendants() (Suhas Daftuar)
5de2baa Rename CTxMemPool::remove -> removeRecursive (Suhas Daftuar)
7659438 CTxMemPool::removeForBlock now uses RemoveStaged (Suhas Daftuar)
2016-03-17 13:33:54 +01:00
Wladimir J. van der Laan 14d6324a24
Merge #7187: Keep reorgs fast for SequenceLocks checks
982670c Add LockPoints (Alex Morcos)
2016-03-16 21:20:04 +01:00
Alex Morcos 982670c333 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-16 16:11:46 -04:00
Pieter Wuille d23f6c6a0d Softfork status report in RPC 2016-03-15 16:54:38 +01: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
Suhas Daftuar 72abd2ce3c Add ancestor tracking to mempool
This implements caching of ancestor state to each mempool entry, similar to
descendant tracking, but also including caching sigops-with-ancestors (as that
metric will be helpful to future code that implements better transaction
selection in CreatenewBlock).
2016-03-14 12:13:33 -04:00
Suhas Daftuar 76a76321d2 Remove work limit in UpdateForDescendants()
The work limit served to prevent the descendant walking algorithm from doing
too much work by marking the parent transaction as dirty.  However to implement
ancestor tracking, it's not possible to similarly mark those descendant
transactions as dirty without having to calculate them to begin with.

This commit removes the work limit altogether.  With appropriate
chain limits (-limitdescendantcount) the concern about doing too much
work inside this function should be mitigated.
2016-03-14 12:13:31 -04:00
Suhas Daftuar 5de2baa138 Rename CTxMemPool::remove -> removeRecursive
remove is no longer called non-recursively, so simplify the logic
and eliminate an unnecessary parameter
2016-03-14 12:11:09 -04:00
Wladimir J. van der Laan 26a2a7214f
Merge #7592: mempool: Re-remove ERROR logging for mempool rejects
8fc81e0 mempool: Reduce ERROR logging for mempool rejects (Wladimir J. van der Laan)
2016-03-11 08:20:42 +01:00
R E Broadley 9988554fc7 No "Unknown command" for getaddr command. 2016-03-08 08:49:42 +00:00
Wladimir J. van der Laan 8fc81e0983 mempool: Reduce ERROR logging for mempool rejects
Continues "Make logging for validation optional" from #6519.

The idea there was to remove all ERROR logging of rejected transaction,
and move it to one message in the class 'mempoolrej' which logs the
state message (and debug info). The superfluous ERRORs in the log
"terrify" users, see for example issue #5794.

Unfortunately a lot of new logging was introduced in #6871 (RBF) and
 #7287 (misc refactoring). This pull updates that new code.
2016-02-24 19:40:29 +01:00
Wladimir J. van der Laan 8b70a64d62
Merge #7526: fix spelling of advertise (shows up in the debug log)
37767fd fix spelling of advertise in src and doc (jloughry)
2016-02-16 12:37:03 +01:00
Wladimir J. van der Laan 2d4f73f47e
Merge #7509: Common argument defaults for NODE_BLOOM stuff and -wallet
1fb91b3 Common argument defaults for NODE_BLOOM stuff and -wallet (Luke Dashjr)
2016-02-16 10:00:21 +01:00
jloughry 37767fd46f fix spelling of advertise in src and doc 2016-02-12 12:51:54 -07: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
jmacwhyte 8aa722609d Fix IsInitialBlockDownload to play nice with testnet 2016-02-11 18:02:46 -08:00
Alex Morcos b043c4b746 fix sdaftuar's nits again
it boggles the mind why these nits can't be delivered on a more timely basis
2016-02-11 15:34:04 -05:00
Luke Dashjr 1fb91b3496 Common argument defaults for NODE_BLOOM stuff and -wallet 2016-02-11 06:38:04 +00: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
Pieter Wuille e4eebb604e Update the wallet best block marker when pruning 2016-02-10 17:11:13 +01:00
Wladimir J. van der Laan 3ffe4b241e
Merge #7482: [P2P] Ensure headers count is correct
301bc7b Update nQueuedValidatedHeaders after peer disconnection (Suhas Daftuar)
2016-02-09 08:54:25 +01:00
Suhas Daftuar 301bc7bc7e Update nQueuedValidatedHeaders after peer disconnection 2016-02-08 15:50:52 -05:00
Wladimir J. van der Laan e7ea5db0c1
Merge #7459: Consensus: Decouple pow.o from util.o
f3757a0 Consensus: Decouple pow.cpp from util.h (Jorge Timón)
2016-02-05 11:19:45 +01:00
Jorge Timón f3757a0391 Consensus: Decouple pow.cpp from util.h 2016-02-04 19:21:55 +01:00
Wladimir J. van der Laan d2228384de
Merge #6480: include the chaintip blockindex in the SyncTransaction signal, add signal UpdateTip()
7d0bf0b include the chaintip *blockIndex in the SyncTransaction signal (Jonas Schnelli)
2016-02-04 17:03:09 +01:00
Wladimir J. van der Laan 4f4dc5ef72
Merge #7070: Move maxTxFee out of mempool
fad6244 ATMP: make nAbsurdFee const (MarcoFalke)
fa762d0 [wallet.h] Remove main.h include (MarcoFalke)
fa79db2 Move maxTxFee out of mempool (MarcoFalke)
2016-02-04 14:54:23 +01:00
Wladimir J. van der Laan eb331794a2
Merge #7225: Eliminate unnecessary call to CheckBlock
dbb89dc Eliminate unnecessary call to CheckBlock (Suhas Daftuar)
2016-02-03 13:23:49 +01:00
MarcoFalke fad6244879 ATMP: make nAbsurdFee const 2016-02-03 13:14:23 +01:00
Wladimir J. van der Laan 5fd95b4490
Merge #7431: Rename permitrbf to mempoolreplacement and provide minimal string-list forward compatibility (needs 0.12 backport)
b922fbe Rename replacebyfee=opt-in to mempoolreplacement=fee (Luke Dashjr)
3b66e54 Simplify check for replacebyfee=opt-in (Luke Dashjr)
d65dee9 Accept replacebyfee=opt-in for turning on opt-in RBF (Luke Dashjr)
77b55a0 Rename permitrbf to replacebyfee (Luke Dashjr)
2016-02-03 10:27:32 +01:00
MarcoFalke fa79db2641 Move maxTxFee out of mempool
Also, remove default values in CMerkleTx::AcceptToMemoryPool()
2016-02-02 20:08:51 +01:00
Wladimir J. van der Laan 11d74f6a6b
Merge #7084: mempool: Replace maxFeeRate of 10000*minRelayTxFee with maxTxFee
fa1193e [doxygen] Actually display comment (MarcoFalke)
fa331db mempool: Replace maxFeeRate of 10000*minRelayTxFee with maxTxFee (MarcoFalke)
2016-02-02 15:18:07 +01:00
Suhas Daftuar dbb89dc793 Eliminate unnecessary call to CheckBlock
ProcessNewBlock would return failure early if CheckBlock failed, before
calling AcceptBlock.  AcceptBlock also calls CheckBlock, and upon failure
would update mapBlockIndex to indicate that a block was failed.  By returning
early in ProcessNewBlock, we were not marking blocks that fail a check in
CheckBlock as permanently failed, and thus would continue to re-request and
reprocess them.
2016-02-01 14:29:45 -05:00
Wladimir J. van der Laan 58a8574400
Merge #7439: Add whitelistforcerelay to control forced relaying. [#7099 redux]
89d113e Blacklist -whitelistalwaysrelay; replaced by -whitelistrelay. (Gregory Maxwell)
325c725 Add whitelistforcerelay to control forced relaying. (Gregory Maxwell)
2016-02-01 14:11:15 +01:00
Wladimir J. van der Laan 31ec14b74b
Merge #7287: Consensus: Remove calls to error() and FormatStateMessage()
93fc58c Consensus: Remove calls to error() and FormatStateMessage() from some consensus code in main (Jorge Timón)
2016-02-01 10:21:53 +01:00
MarcoFalke fa331db68b mempool: Replace maxFeeRate of 10000*minRelayTxFee with maxTxFee 2016-01-30 11:29:22 +01:00
Jorge Timón 93fc58c742 Consensus: Remove calls to error() and FormatStateMessage() from some consensus code in main 2016-01-29 18:38:39 +01:00
Wladimir J. van der Laan 019280617a
Merge #6842: limitfreerelay edge case bugfix
2dfeaa1 limitfreerelay edge case bugfix: (ptschip)
2016-01-29 13:12:02 +01:00
Gregory Maxwell 325c725fb6 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.
2016-01-28 22:26:21 +00:00
Luke Dashjr 77b55a00ed 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-28 05:11:06 +00:00
Wladimir J. van der Laan 6a07208388
Merge #7056: Save last db read
8504867 Save the last unnecessary database read (Alex Morcos)
2016-01-22 14:15:52 +01:00
Wladimir J. van der Laan b768108d9c 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.
2016-01-21 11:24:31 +01:00
Wladimir J. van der Laan f9fd4c2884
Merge pull request #7281: Improve CheckInputs() comment about sig verification
fd83615 Improve CheckInputs() comment about sig verification (Peter Todd)
2016-01-19 13:23:32 +01:00
Wladimir J. van der Laan 3b43cad9d0
Merge pull request #7164: Do not download transactions during initial blockchain sync
39a525c Do not download transactions during inital sync (ptschip)
2016-01-19 12:58:15 +01:00
Wladimir J. van der Laan 47c5ed19f3
Merge pull request #7208
64360f1 Make max tip age an option instead of chainparam (Wladimir J. van der Laan)
2016-01-18 11:55:59 +01:00
Wladimir J. van der Laan dd1304ec21
Merge pull request #7081
45b8e27 -bytespersigop option to additionally limit sigops in transactions we relay and mine (Luke Dashjr)
2016-01-09 18:01:54 +01:00
Luke Dashjr fdc202f4b0 Merge branch bytespersigop 2016-01-09 16:53:12 +00:00
ptschip 2dfeaa1ad0 limitfreerelay edge case bugfix:
If a new transaction will cause limitfreerelay
to be exceeded it should not be accepted
into the memory pool and the byte counter
should be updated only after the fact.
2016-01-06 10:15:00 -08:00
Wladimir J. van der Laan 605c17844e
Merge pull request #7205
fa71669 [devtools] Use git pretty-format for year parsing (MarcoFalke)
fa24439 Bump copyright headers to 2015 (MarcoFalke)
fa6ad85 [devtools] Rewrite fix-copyright-headers.py (MarcoFalke)
2016-01-05 14:11:40 +01:00
Wladimir J. van der Laan a10a7920c3
Merge pull request #7217
5246180 Mark blocks with too many sigops as failed (Suhas Daftuar)
2016-01-05 12:04:53 +01:00
Wladimir J. van der Laan ac982a16e0
Merge pull request #7263
a5a0831 Double semicolon cleanup. (21E14)
2016-01-04 10:17:09 +01:00
Peter Todd fd836153d5
Improve CheckInputs() comment about sig verification 2016-01-03 20:39:05 -08:00
Pieter Wuille 7ef8f3c072 Report non-mandatory script failures correctly 2016-01-03 16:50:31 +01:00
21E14 a5a0831458 Double semicolon cleanup. 2015-12-30 12:23:07 -05:00
Wladimir J. van der Laan c24337964f
Merge pull request #7062
901b01d Remove GetMinRelayFee (Suhas Daftuar)
27fae34 Use fee deltas for determining mempool acceptance (Suhas Daftuar)
9ef2a25 Update replace-by-fee logic to use fee deltas (Suhas Daftuar)
eb30666 Fix mempool limiting for PrioritiseTransaction (Suhas Daftuar)
2015-12-21 17:14:13 +01:00
Suhas Daftuar 5246180f16 Mark blocks with too many sigops as failed 2015-12-15 15:40:50 -05:00
ptschip 39a525c21f Do not download transactions during inital sync 2015-12-15 07:41:44 -08:00
Wladimir J. van der Laan 64360f1304 Make max tip age an option instead of chainparam
After discussion in #7164 I think this is better.

Max tip age was introduced in #5987 to make it possible to run
testnet-in-a-box. But associating this behavior with the testnet chain
is wrong conceptually, as it is not needed in normal usage.
Should aim to make testnet test the software as-is.

Replace it with a (debug) option `-maxtipage`, which can be
specified only in the specific case.
2015-12-14 13:29:28 +01:00
MarcoFalke fa24439ff3 Bump copyright headers to 2015 2015-12-13 18:08:39 +01:00
Pieter Wuille 5400ef6bcb 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.
2015-12-11 22:20:38 +01:00
Wladimir J. van der Laan 9bbe71b641 net: Add and document network messages in protocol.h
- Avoids string typos (by making the compiler check)
- Makes it easier to grep for handling/generation of a certain message type
- Refer directly to documentation by following the symbol in IDE
- Move list of valid message types to protocol.cpp:
    protocol.cpp is a more appropriate place for this, and having
    the array there makes it easier to keep things consistent.
2015-12-10 12:14:06 +01:00
Wladimir J. van der Laan 9fc6ed6003 net: Fix sent reject messages for blocks and transactions
Ever since we #5913 have been sending invalid reject messages
for transactions and blocks.
2015-12-07 14:53:20 +01:00
Matt Corallo 96918a2f09 Don't do mempool lookups for "mempool" command without a filter 2015-12-05 17:45:44 +08:00
Jonas Schnelli 7d0bf0bb46
include the chaintip *blockIndex in the SyncTransaction signal
- allows reducing of calls to main.cpp for getting the chaintip during transaction syncing
- potentially allows reducing of cs_main locks
2015-12-04 09:18:53 +01:00
Gregory Maxwell 6aadc75578 Disconnect on mempool requests from peers when over the upload limit.
Mempool requests use a fair amount of bandwidth when the mempool is large,
 disconnecting peers using them follows the same logic as disconnecting
 peers fetching historical blocks.
2015-12-03 20:13:10 +00:00
Wladimir J. van der Laan 54a550bef8
Merge pull request #7113
086ee67 Switch to a more efficient rolling Bloom filter (Pieter Wuille)
2015-12-03 13:36:07 +01:00
Wladimir J. van der Laan 8843676621
Merge pull request #7133
aa4b0c2 When not filtering blocks, getdata sends more in one test (Pieter Wuille)
d41e44c Actually only use filterInventoryKnown with MSG_TX inventory messages. (Gregory Maxwell)
b6a0da4 Only use filterInventoryKnown with MSG_TX inventory messages. (Patick Strateman)
6b84935 Rename setInventoryKnown filterInventoryKnown (Patick Strateman)
e206724 Remove mruset as it is no longer used. (Gregory Maxwell)
ec73ef3 Replace setInventoryKnown with a rolling bloom filter. (Gregory Maxwell)
2015-12-03 13:16:46 +01:00
Suhas Daftuar 901b01d674 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.
2015-12-02 12:59:30 -05:00
Suhas Daftuar 27fae3484c Use fee deltas for determining mempool acceptance 2015-12-02 12:59:30 -05:00
Suhas Daftuar 9ef2a25603 Update replace-by-fee logic to use fee deltas 2015-12-02 12:59:30 -05:00
paveljanik 5e151a842c PartitionCheck: remove useless spaces 2015-12-02 15:18:23 +01:00
paveljanik 8a03727d9c Fix various typos 2015-12-02 15:18:22 +01:00
Pieter Wuille dd5862c4cd Flush coins cache also after transaction processing 2015-12-01 15:52:09 -08:00
Matt Corallo bde953e281 Uncache input txn in utxo cache if a tx is not accepted to mempool 2015-12-01 15:52:09 -08:00
Matt Corallo 677aa3d88c Discard txn cache entries that were loaded for removed mempool txn 2015-12-01 15:52:07 -08: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
Alex Morcos c49d5bc9e6 Store the total sig op count of a tx.
Store sum of legacy and P2SH sig op counts.  This is calculated in AcceptToMemory pool and storing it saves redoing the expensive calculation in block template creation.
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
Wladimir J. van der Laan 2ef5ffa59a
Merge pull request #6915
2d8860e Fix removeForReorg to use MedianTimePast (Suhas Daftuar)
b7fa4aa Don't call removeForReorg if DisconnectTip fails (Suhas Daftuar)
7e49f5f Track coinbase spends in CTxMemPoolEntry (Suhas Daftuar)
bb8ea1f removeForReorg calls once-per-disconnect-> once-per-reorg (Matt Corallo)
474b84a Make indentation in ActivateBestChainStep readable (Matt Corallo)
b0a064c Fix comment in removeForReorg (Matt Corallo)
9b060e5 Fix removal of time-locked transactions during reorg (Matt Corallo)
0c9959a Add failing test checking timelocked-txn removal during reorg (Matt Corallo)
2015-12-01 13:17:34 +01:00
Wladimir J. van der Laan aabc897801 rpc: Don't translate warning messages
But keep translating them in the GUI.
This - necessarily - requires duplication of a few messages.
Alternative take on #7134, that keeps the translations from being wiped.

Also document GetWarnings() input argument.

Fixes #5895.
2015-12-01 10:07:22 +01:00
Wladimir J. van der Laan 1b5118bfa0
Merge pull request #7079
ebb25f4 Limit setAskFor and retire requested entries only when a getdata returns. (Gregory Maxwell)
5029698 prevent peer flooding request queue for an inv (kazcw)
2015-12-01 09:02:33 +01:00
Suhas Daftuar 2d8860e820 Fix removeForReorg to use MedianTimePast 2015-11-30 14:35:17 -05:00
Suhas Daftuar b7fa4aa387 Don't call removeForReorg if DisconnectTip fails 2015-11-30 13:12:55 -05:00
Suhas Daftuar 7e49f5f8b4 Track coinbase spends in CTxMemPoolEntry
This allows us to optimize CTxMemPool::removeForReorg.
2015-11-30 13:12:53 -05:00
Matt Corallo bb8ea1f630 removeForReorg calls once-per-disconnect-> once-per-reorg 2015-11-30 13:03:57 -05:00
Matt Corallo 474b84a741 Make indentation in ActivateBestChainStep readable 2015-11-30 13:03:56 -05:00
Matt Corallo 9b060e5cfb Fix removal of time-locked transactions during reorg 2015-11-30 13:02:04 -05:00
Gregory Maxwell d41e44c9ac Actually only use filterInventoryKnown with MSG_TX inventory messages.
Previously this logic could erroneously filter a MSG_BLOCK inventory message.
2015-11-30 12:53:48 +01:00
Patick Strateman 6b849350ab Rename setInventoryKnown filterInventoryKnown 2015-11-30 12:53:48 +01:00
Gregory Maxwell ec73ef37ec Replace setInventoryKnown with a rolling bloom filter.
Mruset setInventoryKnown was reduced to a remarkably small 1000
 entries as a side effect of sendbuffer size reductions in 2012.

This removes setInventoryKnown filtering from merkleBlock responses
 because false positives there are especially unattractive and
 also because I'm not sure if there aren't race conditions around
 the relay pool that would cause some transactions there to
 be suppressed. (Also, ProcessGetData was accessing
 setInventoryKnown without taking the required lock.)
2015-11-30 12:53:48 +01:00
Wladimir J. van der Laan 74b5ce24c6
Merge pull request #7116
cb491e7 Trivial: Fix warning introduced by #7053 by casting to uint64_t (Jorge Timón)
2015-11-30 10:18:46 +01:00
Jorge Timón cb491e7788 Trivial: Fix warning introduced by #7053 by casting to uint64_t 2015-11-29 21:19:37 +01:00
Suhas Daftuar 50262d8953 Allow block announcements with headers
This replaces using inv messages to announce new blocks, when a peer requests
(via the new "sendheaders" message) that blocks be announced with headers
instead of inv's.

Since headers-first was introduced, peers send getheaders messages in response
to an inv, which requires generating a block locator that is large compared to
the size of the header being requested, and requires an extra round-trip before
a reorg can be relayed.  Save time by tracking headers that a peer is likely to
know about, and send a headers chain that would connect to a peer's known
headers, unless the chain would be too big, in which case we revert to sending
an inv instead.

Based off of @sipa's commit to announce all blocks in a reorg via inv,
which has been squashed into this commit.

Rebased-by: Pieter Wuille
2015-11-29 11:59:23 +01:00