HomePhabricator

Merge #13439: rpc: Avoid "duplicate" return value for invalid submitblock

Description

Merge #13439: rpc: Avoid "duplicate" return value for invalid submitblock

Summary:
f74894480 Only set fNewBlock to true in AcceptBlock when we write to disk (Matt Corallo)
fa6e49731 rpc: Avoid "duplicate" return value for invalid submitblock (MarcoFalke)

Pull request description:

This is #13395 with one more commit tacked on. MarcoFalke got tired of dealing with the stupidity of fixing a return code with too many rounds of review (not that I blame him). Honestly we should probably have no return whatsoever, but for now, this fixes it (as well as nLastBlockTime for eviction purposes).

Original description:

When `submitblock` of an invalid block, the return value should not be `"duplicate"`.

This is only seen when the header was previously found (denoted by the incorrectly named boolean `fBlockPresent`). Fix this bug by removing `fBlockPresent`.

Tree-SHA512: 0ce3092655d5d904b4c8c5ff7479f73ce387144a738f20472b8af132564005c6db5594ae366e589508f6258506ee7a28b1c7995a83a8328b334f99316006bf2d

Backport of Core PR13439
https://github.com/bitcoin/bitcoin/pull/13439/files

Test Plan:

make check
test_runner.py

Reviewers: #bitcoin_abc, deadalnix, nakihito

Reviewed By: #bitcoin_abc, deadalnix, nakihito

Differential Revision: https://reviews.bitcoinabc.org/D3856

Details

Provenance
Jonas Schnelli <dev@jonasschnelli.ch>Authored on Jun 19 2018, 07:25
jasonbcoxCommitted on Sep 12 2019, 20:23
jasonbcoxPushed on Sep 12 2019, 20:26
Reviewer
Restricted Project
Differential Revision
D3856: Merge #13439: rpc: Avoid "duplicate" return value for invalid submitblock
Parents
rSTAGING111c41e1b8f9: Updated seeds
Branches
Unknown
Tags
Unknown