test
This commit is contained in:
@@ -53,7 +53,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
|
|||||||
//
|
//
|
||||||
// Start
|
// Start
|
||||||
//
|
//
|
||||||
extern int32_t IS_KOMODO_NOTARY;
|
extern int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY;
|
||||||
extern std::string NOTARY_PUBKEY;
|
extern std::string NOTARY_PUBKEY;
|
||||||
|
|
||||||
bool AppInit(int argc, char* argv[])
|
bool AppInit(int argc, char* argv[])
|
||||||
@@ -111,8 +111,10 @@ bool AppInit(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
||||||
NOTARY_PUBKEY = GetArg("-pubkey", "");
|
NOTARY_PUBKEY = GetArg("-pubkey", "");
|
||||||
|
if ( strlen(NOTARY_PUBKEY.c_str()) == 66 )
|
||||||
|
USE_EXTERNAL_PUBKEY = 1;
|
||||||
fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str());
|
fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str());
|
||||||
|
|
||||||
// Command-line RPC
|
// Command-line RPC
|
||||||
bool fCommandLine = false;
|
bool fCommandLine = false;
|
||||||
for (int i = 1; i < argc; i++)
|
for (int i = 1; i < argc; i++)
|
||||||
|
|||||||
11
src/komodo.h
11
src/komodo.h
@@ -19,11 +19,18 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int32_t IS_KOMODO_NOTARY;
|
int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY;
|
||||||
std::string NOTARY_PUBKEY;
|
std::string NOTARY_PUBKEY;
|
||||||
|
|
||||||
int32_t komodo_is_notaryblock(void *block)
|
int32_t komodo_is_notaryblock(uint8_t *pblock,uint8_t *coinbase,uint8_t *minerout)
|
||||||
{
|
{
|
||||||
|
int32_t i;
|
||||||
|
for (i=0; i<5; i++)
|
||||||
|
printf("%02x",coinbase[i]);
|
||||||
|
printf(" <- coinbase\n");
|
||||||
|
for (i=0; i<35; i++)
|
||||||
|
printf("%02x",minerout[i]);
|
||||||
|
printf(" <- minerout\n");
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -414,9 +414,9 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
|
|||||||
if (!reservekey.GetReservedKey(pubkey))
|
if (!reservekey.GetReservedKey(pubkey))
|
||||||
return NULL;
|
return NULL;
|
||||||
scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG;
|
scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG;
|
||||||
if ( IS_KOMODO_NOTARY != 0 )
|
if ( USE_EXTERNAL_PUBKEY != 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"use notary pubkey\n");
|
//fprintf(stderr,"use notary pubkey\n");
|
||||||
scriptPubKey = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;
|
scriptPubKey = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;
|
||||||
}
|
}
|
||||||
return CreateNewBlock(scriptPubKey);
|
return CreateNewBlock(scriptPubKey);
|
||||||
@@ -495,7 +495,7 @@ void static BitcoinMiner(CWallet *pwallet)
|
|||||||
} while (true);
|
} while (true);
|
||||||
fprintf(stderr,"Found peers\n");
|
fprintf(stderr,"Found peers\n");
|
||||||
}
|
}
|
||||||
fprintf(stderr,"create new block\n");
|
//fprintf(stderr,"create new block\n");
|
||||||
//
|
//
|
||||||
// Create new block
|
// Create new block
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -16,14 +16,14 @@
|
|||||||
|
|
||||||
#include "sodium.h"
|
#include "sodium.h"
|
||||||
|
|
||||||
int32_t komodo_is_notaryblock(void *pblock);
|
int32_t komodo_is_notaryblock(uint8_t *pblock,uint8_t *coinbase,uint8_t *minerout);
|
||||||
|
|
||||||
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
|
unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params)
|
||||||
{
|
{
|
||||||
unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact();
|
unsigned int nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact();
|
||||||
|
|
||||||
// Genesis block
|
// Genesis block
|
||||||
if (pindexLast == NULL || komodo_is_notaryblock((void *)pblock) != 0 )
|
if (pindexLast == NULL || komodo_is_notaryblock((uint8_t *)pblock,(uint8_t *)pblock->vin[0].scriptSig,(uint8_t *)pblock->vout[0].scriptPubKey) != 0 )
|
||||||
return nProofOfWorkLimit;
|
return nProofOfWorkLimit;
|
||||||
|
|
||||||
// Find the first block in the averaging interval
|
// Find the first block in the averaging interval
|
||||||
|
|||||||
Reference in New Issue
Block a user