From ef7beaea6abcaab389ccb486a8f25bc4512b99ed Mon Sep 17 00:00:00 2001 From: Aaron Clauson Date: Fri, 10 Aug 2018 09:19:00 +0200 Subject: Visual Studio build configuration for Bitcoin Core --- build_msvc/testconsensus/testconsensus.cpp | 50 +++++++ build_msvc/testconsensus/testconsensus.vcxproj | 173 +++++++++++++++++++++++++ 2 files changed, 223 insertions(+) create mode 100644 build_msvc/testconsensus/testconsensus.cpp create mode 100644 build_msvc/testconsensus/testconsensus.vcxproj (limited to 'build_msvc/testconsensus') diff --git a/build_msvc/testconsensus/testconsensus.cpp b/build_msvc/testconsensus/testconsensus.cpp new file mode 100644 index 0000000000..0068f588cc --- /dev/null +++ b/build_msvc/testconsensus/testconsensus.cpp @@ -0,0 +1,50 @@ +#include + +// bitcoin includes. +#include <..\src\script\bitcoinconsensus.h> +#include <..\src\primitives\transaction.h> +#include <..\src\script\script.h> +#include <..\src\streams.h> +#include <..\src\version.h> + +CMutableTransaction BuildSpendingTransaction(const CScript& scriptSig, const CScriptWitness& scriptWitness, int nValue = 0) +{ + CMutableTransaction txSpend; + txSpend.nVersion = 1; + txSpend.nLockTime = 0; + txSpend.vin.resize(1); + txSpend.vout.resize(1); + txSpend.vin[0].scriptWitness = scriptWitness; + txSpend.vin[0].prevout.hash = uint256(); + txSpend.vin[0].prevout.n = 0; + txSpend.vin[0].scriptSig = scriptSig; + txSpend.vin[0].nSequence = CTxIn::SEQUENCE_FINAL; + txSpend.vout[0].scriptPubKey = CScript(); + txSpend.vout[0].nValue = nValue; + + return txSpend; +} + +int main() +{ + std::cout << "bitcoinconsensus version: " << bitcoinconsensus_version() << std::endl; + + CScript pubKeyScript; + pubKeyScript << OP_1 << OP_0 << OP_1; + + int amount = 0; // 600000000; + + CScript scriptSig; + CScriptWitness scriptWitness; + CTransaction vanillaSpendTx = BuildSpendingTransaction(scriptSig, scriptWitness, amount); + CDataStream stream(SER_NETWORK, PROTOCOL_VERSION); + stream << vanillaSpendTx; + + bitcoinconsensus_error err; + auto op0Result = bitcoinconsensus_verify_script_with_amount(pubKeyScript.data(), pubKeyScript.size(), amount, (const unsigned char*)&stream[0], stream.size(), 0, bitcoinconsensus_SCRIPT_FLAGS_VERIFY_ALL, &err); + std::cout << "Op0 result: " << op0Result << ", error code " << err << std::endl; + + getchar(); + + return 0; +} diff --git a/build_msvc/testconsensus/testconsensus.vcxproj b/build_msvc/testconsensus/testconsensus.vcxproj new file mode 100644 index 0000000000..d73988df1c --- /dev/null +++ b/build_msvc/testconsensus/testconsensus.vcxproj @@ -0,0 +1,173 @@ + + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {E78473E9-B850-456C-9120-276301E04C06} + Win32Proj + testconsensus + test_libbitcoinconsensus + x86-windows-static + x64-windows-static + + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + static + + + true + static + + + false + static + + + false + + + + NotUsing + Level3 + Disabled + HAVE_CONFIG_H;WIN32;_SCL_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\src\; + MultiThreadedDebug + + + Console + true + + + + + NotUsing + Level3 + Disabled + HAVE_CONFIG_H;_SCL_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\src\; + MultiThreadedDebug + + + Console + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + NotUsing + Level3 + MaxSpeed + true + true + HAVE_CONFIG_H;_SCL_SECURE_NO_WARNINGS;WIN32;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\src\; + MultiThreaded + + + Console + true + true + true + + + + + NotUsing + Level3 + MaxSpeed + true + true + HAVE_CONFIG_H;WIN32;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\src\; + MultiThreaded + + + Console + true + true + true + + + + + + + + {2b384fa8-9ee1-4544-93cb-0d733c25e8ce} + + + {b53a5535-ee9d-4c6f-9a26-f79ee3bc3754} + + + + -- cgit v1.2.3