--- /dev/null
+#include <gtest/gtest.h>
+
+#include "consensus/validation.h"
+#include "main.h"
+
+// Fake an empty view
+class FakeCoinsViewDB : public CCoinsView {
+public:
+ FakeCoinsViewDB() {}
+
+ bool GetAnchorAt(const uint256 &rt, ZCIncrementalMerkleTree &tree) const {
+ return false;
+ }
+
+ bool GetNullifier(const uint256 &nf) const {
+ return false;
+ }
+
+ bool GetCoins(const uint256 &txid, CCoins &coins) const {
+ return false;
+ }
+
+ bool HaveCoins(const uint256 &txid) const {
+ return false;
+ }
+
+ uint256 GetBestBlock() const {
+ uint256 a;
+ return a;
+ }
+
+ uint256 GetBestAnchor() const {
+ uint256 a;
+ return a;
+ }
+
+ bool BatchWrite(CCoinsMap &mapCoins,
+ const uint256 &hashBlock,
+ const uint256 &hashAnchor,
+ CAnchorsMap &mapAnchors,
+ CNullifiersMap &mapNullifiers) {
+ return false;
+ }
+
+ bool GetStats(CCoinsStats &stats) const {
+ return false;
+ }
+};
+
+TEST(Validation, ContextualCheckInputsPassesWithCoinbase) {
+ // Create fake coinbase transaction
+ CMutableTransaction mtx;
+ mtx.vin.resize(1);
+ CTransaction tx(mtx);
+ ASSERT_TRUE(tx.IsCoinBase());
+
+ // Fake an empty view
+ FakeCoinsViewDB fakeDB;
+ CCoinsViewCache view(&fakeDB);
+
+ CValidationState state;
+ EXPECT_TRUE(ContextualCheckInputs(tx, state, view, false, 0, false, Params(CBaseChainParams::MAIN).GetConsensus()));
+}