Skip to content

Commit

Permalink
Merge pull request #18 from sunnyking/master
Browse files Browse the repository at this point in the history
Advanced Checkpoint Feature
  • Loading branch information
FeatherCoin committed Aug 25, 2013
2 parents 26731e0 + b097467 commit 1619f83
Show file tree
Hide file tree
Showing 16 changed files with 891 additions and 8 deletions.
6 changes: 4 additions & 2 deletions feathercoin-qt.pro
Expand Up @@ -165,7 +165,8 @@ HEADERS += src/qt/bitcoingui.h \
src/scrypt.h \
src/qt/miningpage.h \
src/version.h \
src/qt/rpcconsole.h
src/qt/rpcconsole.h \
src/checkpointsync.h

SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \
src/qt/transactiontablemodel.cpp \
Expand Down Expand Up @@ -226,7 +227,8 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \
src/qt/rpcconsole.cpp \
src/scrypt.c \
src/qt/miningpage.cpp \
src/noui.cpp
src/noui.cpp \
src/checkpointsync.cpp

RESOURCES += \
src/qt/bitcoin.qrc
Expand Down
9 changes: 9 additions & 0 deletions src/bitcoinrpc.cpp
Expand Up @@ -54,6 +54,10 @@ extern Value createrawtransaction(const Array& params, bool fHelp);
extern Value decoderawtransaction(const Array& params, bool fHelp);
extern Value signrawtransaction(const Array& params, bool fHelp);
extern Value sendrawtransaction(const Array& params, bool fHelp);
extern json_spirit::Value getcheckpoint(const json_spirit::Array& params, bool fHelp); // in checkpointsync.cpp
extern json_spirit::Value sendcheckpoint(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value enforcecheckpoint(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value makekeypair(const json_spirit::Array& params, bool fHelp);

const Object emptyobj;

Expand Down Expand Up @@ -2371,6 +2375,10 @@ static const CRPCCommand vRPCCommands[] =
{ "listsinceblock", &listsinceblock, false },
{ "dumpprivkey", &dumpprivkey, false },
{ "importprivkey", &importprivkey, false },
{ "getcheckpoint", &getcheckpoint, true },
{ "sendcheckpoint", &sendcheckpoint, true },
{ "enforcecheckpoint", &enforcecheckpoint, true },
{ "makekeypair", &makekeypair, true },
{ "listunspent", &listunspent, false },
{ "getrawtransaction", &getrawtransaction, false },
{ "createrawtransaction", &createrawtransaction, false },
Expand Down Expand Up @@ -3272,6 +3280,7 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
if (strMethod == "walletpassphrase" && n > 1) ConvertTo<boost::int64_t>(params[1]);
if (strMethod == "getblocktemplate" && n > 0) ConvertTo<Object>(params[0]);
if (strMethod == "listsinceblock" && n > 1) ConvertTo<boost::int64_t>(params[1]);
if (strMethod == "enforcecheckpoint" && n > 0) ConvertTo<bool>(params[0]);
if (strMethod == "sendmany" && n > 1) ConvertTo<Object>(params[1]);
if (strMethod == "sendmany" && n > 2) ConvertTo<boost::int64_t>(params[2]);
if (strMethod == "addmultisigaddress" && n > 0) ConvertTo<boost::int64_t>(params[0]);
Expand Down
6 changes: 6 additions & 0 deletions src/checkpoints.cpp
Expand Up @@ -66,4 +66,10 @@ namespace Checkpoints
}
return NULL;
}

uint256 GetLatestHardenedCheckpoint()
{
const MapCheckpoints& checkpoints = mapCheckpoints;
return (checkpoints.rbegin()->second);
}
}
3 changes: 3 additions & 0 deletions src/checkpoints.h
Expand Up @@ -24,6 +24,9 @@ namespace Checkpoints

// Returns last CBlockIndex* in mapBlockIndex that is a checkpoint
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex);

// Returns the block hash of latest hardened checkpoint
uint256 GetLatestHardenedCheckpoint();
}

#endif

0 comments on commit 1619f83

Please sign in to comment.