Support -ac_pubkey without -ac_perc

If ac_pubkey is set, then height 1 out must go to that pub key
This commit is contained in:
jl777
2018-05-30 02:43:08 -11:00
parent 6fd79871df
commit d9f176ac7e
4 changed files with 29 additions and 15 deletions

View File

@@ -108,7 +108,8 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams,
extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,KOMODO_PASSPORT_INITDONE;
extern uint64_t ASSETCHAINS_REWARD,ASSETCHAINS_COMMISSION,ASSETCHAINS_STAKED;
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
extern std::string NOTARY_PUBKEY;
extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY;
extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];
uint32_t Mining_start,Mining_height;
int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
@@ -582,10 +583,14 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
// Internal miner
//
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey,int32_t nHeight)
{
CPubKey pubkey; CScript scriptPubKey; uint8_t *script,*ptr; int32_t i;
if ( USE_EXTERNAL_PUBKEY != 0 )
if ( nHeight == 1 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 )
{
scriptPubKey = CScript() << ParseHex(ASSETCHAINS_OVERRIDE_PUBKEY) << OP_CHECKSIG;
}
else if ( USE_EXTERNAL_PUBKEY != 0 )
{
//fprintf(stderr,"use notary pubkey\n");
scriptPubKey = CScript() << ParseHex(NOTARY_PUBKEY) << OP_CHECKSIG;
@@ -787,7 +792,7 @@ void static BitcoinMiner()
sleep(3);
}
#ifdef ENABLE_WALLET
CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey);
CBlockTemplate *ptr = CreateNewBlockWithKey(reservekey,pindexPrev->nHeight+1);
#else
CBlockTemplate *ptr = CreateNewBlockWithKey();
#endif