aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-11-18 17:28:44 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-11-18 17:37:58 +0100
commit73fa5e604356ab4182971376fd758b4680737b5a (patch)
tree0a26db42198a0249c729e65a412304e7f996cab4 /src/main.cpp
parent03403d8c0f3b40f04ef9fac8781ac8e19ed304ec (diff)
parent1cf3dd80a614fddbafac387e446fd83d118e0c25 (diff)
downloadbitcoin-73fa5e604356ab4182971376fd758b4680737b5a.tar.xz
Merge pull request #6932
1cf3dd8 Add unit test for UpdateCoins (Alex Morcos) 03c8282 Make CCoinsViewTest behave like CCoinsViewDB (Alex Morcos) 14470f9 ModifyNewCoins saves database lookups (Alex Morcos)
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 86bf957436..8fb121c00d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1310,10 +1310,17 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach
undo.nVersion = coins->nVersion;
}
}
+ // add outputs
+ inputs.ModifyNewCoins(tx.GetHash())->FromTx(tx, nHeight);
+ }
+ else {
+ // add outputs for coinbase tx
+ // In this case call the full ModifyCoins which will do a database
+ // lookup to be sure the coins do not already exist otherwise we do not
+ // know whether to mark them fresh or not. We want the duplicate coinbases
+ // before BIP30 to still be properly overwritten.
+ inputs.ModifyCoins(tx.GetHash())->FromTx(tx, nHeight);
}
-
- // add outputs
- inputs.ModifyCoins(tx.GetHash())->FromTx(tx, nHeight);
}
void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, int nHeight)