diff options
author | Matt Corallo <git@bluematt.me> | 2016-10-02 12:22:05 -0400 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2016-11-23 16:29:38 -0800 |
commit | 4a6b1f36b773001f6c5a8e1d3d196833e4fb872d (patch) | |
tree | ad3335f52ef392ee170fbefb8829158c3ce943a5 /src/main.cpp | |
parent | 93566e0c37c5ae104095474fea89f00dcb40f551 (diff) |
Expose AcceptBlockHeader through main.h
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 05442057e4..4a2682bc78 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3649,7 +3649,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, const Co return true; } -static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex=NULL) +static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex) { AssertLockHeld(cs_main); // Check for duplicate @@ -3698,6 +3698,21 @@ static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state return true; } +// Exposed wrapper for AcceptBlockHeader +bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex) +{ + { + LOCK(cs_main); + for (const CBlockHeader& header : headers) { + if (!AcceptBlockHeader(header, state, chainparams, ppindex)) { + return false; + } + } + } + NotifyHeaderTip(); + return true; +} + /** Store block on disk. If dbp is non-NULL, the file is known to already reside on disk */ static bool AcceptBlock(const CBlock& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool fRequested, const CDiskBlockPos* dbp, bool* fNewBlock) { |