forked from nopslide/mtp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
9,640 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25420.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project1", "Project1\Project1.vcxproj", "{B0858739-6A62-4C9B-A8BC-C87DAFEF415D}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{B0858739-6A62-4C9B-A8BC-C87DAFEF415D}.Debug|x64.ActiveCfg = Debug|x64 | ||
{B0858739-6A62-4C9B-A8BC-C87DAFEF415D}.Debug|x64.Build.0 = Debug|x64 | ||
{B0858739-6A62-4C9B-A8BC-C87DAFEF415D}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{B0858739-6A62-4C9B-A8BC-C87DAFEF415D}.Debug|x86.Build.0 = Debug|Win32 | ||
{B0858739-6A62-4C9B-A8BC-C87DAFEF415D}.Release|x64.ActiveCfg = Release|x64 | ||
{B0858739-6A62-4C9B-A8BC-C87DAFEF415D}.Release|x64.Build.0 = Release|x64 | ||
{B0858739-6A62-4C9B-A8BC-C87DAFEF415D}.Release|x86.ActiveCfg = Release|Win32 | ||
{B0858739-6A62-4C9B-A8BC-C87DAFEF415D}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|Win32"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{B0858739-6A62-4C9B-A8BC-C87DAFEF415D}</ProjectGuid> | ||
<RootNamespace>Project1</RootNamespace> | ||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v140</PlatformToolset> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v140</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v140</PlatformToolset> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v140</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Label="Shared"> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup /> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
<SDLCheck>true</SDLCheck> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
<SDLCheck>false</SDLCheck> | ||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;GENKAT;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<SDLCheck>true</SDLCheck> | ||
</ClCompile> | ||
<Link> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<SDLCheck>true</SDLCheck> | ||
</ClCompile> | ||
<Link> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClCompile Include="block.cpp" /> | ||
<ClCompile Include="main.cpp" /> | ||
<ClCompile Include="merkle.cpp" /> | ||
<ClCompile Include="ripemd160.cpp" /> | ||
<ClCompile Include="script.cpp" /> | ||
<ClCompile Include="sha256.cpp" /> | ||
<ClCompile Include="transaction.cpp" /> | ||
<ClCompile Include="uint256.cpp" /> | ||
<ClCompile Include="utilstrencodings.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="amount.h" /> | ||
<ClInclude Include="argon2.h" /> | ||
<ClInclude Include="block.h" /> | ||
<ClInclude Include="byteswap.h" /> | ||
<ClInclude Include="common.h" /> | ||
<ClInclude Include="endian.h" /> | ||
<ClInclude Include="hash.h" /> | ||
<ClInclude Include="merkle.h" /> | ||
<ClInclude Include="prevector.h" /> | ||
<ClInclude Include="ripemd160.h" /> | ||
<ClInclude Include="script.h" /> | ||
<ClInclude Include="serialize.h" /> | ||
<ClInclude Include="sha256.h" /> | ||
<ClInclude Include="tinyformat.h" /> | ||
<ClInclude Include="transaction.h" /> | ||
<ClInclude Include="uint256.h" /> | ||
<ClInclude Include="utilstrencodings.h" /> | ||
<ClInclude Include="version.h" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
</Filter> | ||
<Filter Include="Header Files"> | ||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
</Filter> | ||
<Filter Include="Resource Files"> | ||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="main.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="block.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="ripemd160.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="script.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="sha256.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="transaction.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="uint256.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="utilstrencodings.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="merkle.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="argon2.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="byteswap.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="endian.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="hash.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="ripemd160.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="script.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="serialize.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="sha256.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="tinyformat.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="transaction.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="uint256.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="utilstrencodings.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="version.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="merkle.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="amount.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="common.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="prevector.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="block.h"> | ||
<Filter>Resource Files</Filter> | ||
</ClInclude> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright (c) 2009-2010 Satoshi Nakamoto | ||
// Copyright (c) 2009-2015 The Bitcoin Core developers | ||
// Distributed under the MIT software license, see the accompanying | ||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#ifndef BITCOIN_AMOUNT_H | ||
#define BITCOIN_AMOUNT_H | ||
|
||
#include "serialize.h" | ||
|
||
#include <stdlib.h> | ||
#include <string> | ||
|
||
/** Amount in satoshis (Can be negative) */ | ||
typedef int64_t CAmount; | ||
|
||
static const CAmount COIN = 100000000; | ||
static const CAmount CENT = 1000000; | ||
|
||
extern const std::string CURRENCY_UNIT; | ||
|
||
/** No amount larger than this (in satoshi) is valid. | ||
* | ||
* Note that this constant is *not* the total money supply, which in Bitcoin | ||
* currently happens to be less than 21,000,000 BTC for various reasons, but | ||
* rather a sanity check. As this sanity check is used by consensus-critical | ||
* validation code, the exact value of the MAX_MONEY constant is consensus | ||
* critical; in unusual circumstances like a(nother) overflow bug that allowed | ||
* for the creation of coins out of thin air modification could lead to a fork. | ||
* */ | ||
static const CAmount MAX_MONEY = 21000000 * COIN; | ||
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } | ||
|
||
/** | ||
* Fee rate in satoshis per kilobyte: CAmount / kB | ||
*/ | ||
class CFeeRate | ||
{ | ||
private: | ||
CAmount nSatoshisPerK; // unit is satoshis-per-1,000-bytes | ||
public: | ||
/** Fee rate of 0 satoshis per kB */ | ||
CFeeRate() : nSatoshisPerK(0) { } | ||
explicit CFeeRate(const CAmount& _nSatoshisPerK) : nSatoshisPerK(_nSatoshisPerK) { } | ||
/** Constructor for a fee rate in satoshis per kB. The size in bytes must not exceed (2^63 - 1)*/ | ||
CFeeRate(const CAmount& nFeePaid, size_t nBytes); | ||
CFeeRate(const CFeeRate& other) { nSatoshisPerK = other.nSatoshisPerK; } | ||
/** | ||
* Return the fee in satoshis for the given size in bytes. | ||
*/ | ||
CAmount GetFee(size_t nBytes) const; | ||
/** | ||
* Return the fee in satoshis for a size of 1000 bytes | ||
*/ | ||
CAmount GetFeePerK() const { return GetFee(1000); } | ||
friend bool operator<(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK < b.nSatoshisPerK; } | ||
friend bool operator>(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK > b.nSatoshisPerK; } | ||
friend bool operator==(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK == b.nSatoshisPerK; } | ||
friend bool operator<=(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK <= b.nSatoshisPerK; } | ||
friend bool operator>=(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK >= b.nSatoshisPerK; } | ||
CFeeRate& operator+=(const CFeeRate& a) { nSatoshisPerK += a.nSatoshisPerK; return *this; } | ||
std::string ToString() const; | ||
|
||
ADD_SERIALIZE_METHODS; | ||
|
||
template <typename Stream, typename Operation> | ||
inline void SerializationOp(Stream& s, Operation ser_action) { | ||
READWRITE(nSatoshisPerK); | ||
} | ||
}; | ||
|
||
#endif // BITCOIN_AMOUNT_H |
Oops, something went wrong.