|
|
@ -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); |
|
|
@ -439,7 +440,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) |
|
|
|
txNew.vin[0].scriptSig = CScript() << nHeight << OP_0; |
|
|
|
|
|
|
|
pblock->vtx[0] = txNew; |
|
|
|
if ( ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && ASSETCHAINS_COMMISSION != 0 && (commission= komodo_commission((CBlock*)&pblocktemplate->block)) != 0 ) |
|
|
|
if ( nHeight > 1 && ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 && ASSETCHAINS_COMMISSION != 0 && (commission= komodo_commission((CBlock*)&pblocktemplate->block)) != 0 ) |
|
|
|
{ |
|
|
|
int32_t i; uint8_t *ptr; |
|
|
|
txNew.vout.resize(2); |
|
|
@ -478,11 +479,13 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) |
|
|
|
pblock->nTime = pindexPrev->nTime + 65; |
|
|
|
if ( komodo_notaryvin(txNotary,NOTARY_PUBKEY33) > 0 ) |
|
|
|
{ |
|
|
|
CAmount txfees = 0; |
|
|
|
CAmount txfees = 5000; |
|
|
|
pblock->vtx.push_back(txNotary); |
|
|
|
pblocktemplate->vTxFees.push_back(txfees); |
|
|
|
pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txNotary)); |
|
|
|
nFees += txfees; |
|
|
|
pblocktemplate->vTxFees[0] = -nFees; |
|
|
|
//*(uint64_t *)(&pblock->vtx[0].vout[0].nValue) += txfees;
|
|
|
|
//fprintf(stderr,"added notaryvin\n");
|
|
|
|
} |
|
|
|
else |
|
|
@ -582,10 +585,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 +794,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 |
|
|
|