diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-04-16 11:43:52 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-04-16 11:44:03 -0400 |
commit | f4c0ad4aefe0a59d629c415d0ceac63bf2c0bb58 (patch) | |
tree | f276c265efb36575534191ff69cd6694e0b78a13 /src/interfaces | |
parent | 661e8df1b63b213d2d5b0d7cba0733869b508af9 (diff) | |
parent | 9986608ba93de040490ee0d5584ea33e605f1df0 (diff) |
Merge #18660: test: Verify findCommonAncestor always initializes outputs
9986608ba93de040490ee0d5584ea33e605f1df0 test: Verify findCommonAncestor always initializes outputs (Russell Yanofsky)
Pull request description:
Also add code comment to clarify surprising code noted by practicalswift
https://github.com/bitcoin/bitcoin/pull/18657#issuecomment-614278450
ACKs for top commit:
MarcoFalke:
ACK 9986608ba93de040490ee0d5584ea33e605f1df0
jonatack:
ACK 9986608ba93de04 modulo @practicalswift's https://github.com/bitcoin/bitcoin/pull/18660#issuecomment-614487724
Tree-SHA512: d79c910291d68b770ef4b09564d274c0e19a6acf43ef1a6691dc889e3944ab3462b86056eeb794fd0c6f2464cfad6cc00711a833f84b32079c69ef9b3c8da24c
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/chain.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp index c8311b2986..0e7641ae32 100644 --- a/src/interfaces/chain.cpp +++ b/src/interfaces/chain.cpp @@ -275,6 +275,8 @@ public: const CBlockIndex* block1 = LookupBlockIndex(block_hash1); const CBlockIndex* block2 = LookupBlockIndex(block_hash2); const CBlockIndex* ancestor = block1 && block2 ? LastCommonAncestor(block1, block2) : nullptr; + // Using & instead of && below to avoid short circuiting and leaving + // output uninitialized. return FillBlock(ancestor, ancestor_out, lock) & FillBlock(block1, block1_out, lock) & FillBlock(block2, block2_out, lock); } void findCoins(std::map<COutPoint, Coin>& coins) override { return FindCoins(m_node, coins); } |