From dd0df81ebdbf705f7ad386c7229bf1bbc3125f62 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 29 Nov 2016 21:25:39 -0800 Subject: [PATCH] Document ConnectBlock connectTrace postconditions --- src/validation.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/validation.cpp b/src/validation.cpp index 0983c1f76..3bcbf33d6 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2164,6 +2164,10 @@ struct ConnectTrace { /** * Connect a new block to chainActive. pblock is either NULL or a pointer to a CBlock * corresponding to pindexNew, to bypass loading it again from disk. + * + * The block is always added to connectTrace (either after loading from disk or by copying + * pblock) - if that is not intended, care must be taken to remove the last entry in + * blocksConnected in case of failure. */ bool static ConnectTip(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const std::shared_ptr& pblock, ConnectTrace& connectTrace) {