Browse Source

test

pull/4/head
jl777 8 years ago
parent
commit
7bfc207ada
  1. 6
      src/bitcoind.cpp
  2. 11
      src/komodo.h
  3. 6
      src/miner.cpp
  4. 4
      src/pow.cpp

6
src/bitcoind.cpp

@ -53,7 +53,7 @@ void WaitForShutdown(boost::thread_group* threadGroup)
//
// Start
//
extern int32_t IS_KOMODO_NOTARY;
extern int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY;
extern std::string NOTARY_PUBKEY;
bool AppInit(int argc, char* argv[])
@ -111,8 +111,10 @@ bool AppInit(int argc, char* argv[])
}
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
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());
// Command-line RPC
bool fCommandLine = false;
for (int i = 1; i < argc; i++)

11
src/komodo.h

@ -19,11 +19,18 @@
#include <stdint.h>
#include <stdio.h>
int32_t IS_KOMODO_NOTARY;
int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_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);
}

6
src/miner.cpp

@ -414,9 +414,9 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
if (!reservekey.GetReservedKey(pubkey))
return NULL;
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;
}
return CreateNewBlock(scriptPubKey);
@ -495,7 +495,7 @@ void static BitcoinMiner(CWallet *pwallet)
} while (true);
fprintf(stderr,"Found peers\n");
}
fprintf(stderr,"create new block\n");
//fprintf(stderr,"create new block\n");
//
// Create new block
//

4
src/pow.cpp

@ -16,14 +16,14 @@
#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 nProofOfWorkLimit = UintToArith256(params.powLimit).GetCompact();
// 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;
// Find the first block in the averaging interval

Loading…
Cancel
Save