This commit is contained in:
jl777
2016-11-13 11:46:27 -03:00
parent e4a1e28c14
commit f24b36ca4c
5 changed files with 33 additions and 14 deletions

View File

@@ -388,6 +388,23 @@ void komodo_disconnect(CBlockIndex *pindex,CBlock& block)
//komodo_stateupdate(-pindex->nHeight,0,0,0,zero,0,0,0,0,0,0,0); //komodo_stateupdate(-pindex->nHeight,0,0,0,zero,0,0,0,0,0,0,0);
} }
int32_t komodo_is_notarytx(const CTransaction& tx)
{
uint8_t *ptr,crypto777[33];
#ifdef KOMODO_ZCASH
ptr = (uint8_t *)block->vtx[0].vout[0].scriptPubKey.data();
#else
ptr = (uint8_t *)&block->vtx[0].vout[0].scriptPubKey[0];
#endif
decode_hex(crypto777,33,(char *)CRYPTO777_PUBSECPSTR);
if ( memcmp(ptr+1,crypto777,33) == 0 )
{
printf("found notarytx\n");
return(1);
}
else return(0);
}
int32_t komodo_block2height(CBlock *block) int32_t komodo_block2height(CBlock *block)
{ {
int32_t i,n,height = 0; uint8_t *ptr; int32_t i,n,height = 0; uint8_t *ptr;

View File

@@ -23,7 +23,7 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33)
int COINBASE_MATURITY = 100; int COINBASE_MATURITY = 100;
int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,CURRENT_HEIGHT,ASSETCHAINS_SEED; int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,CURRENT_HEIGHT,ASSETCHAINS_SEED,KOMODO_ON_DEMAND;
std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES;
uint8_t NOTARY_PUBKEY33[33]; uint8_t NOTARY_PUBKEY33[33];

View File

@@ -1044,6 +1044,7 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio
CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree) CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree)
{ {
extern int32_t KOMODO_ON_DEMAND;
{ {
LOCK(mempool.cs); LOCK(mempool.cs);
uint256 hash = tx.GetHash(); uint256 hash = tx.GetHash();
@@ -1268,6 +1269,8 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
} }
// Store transaction in memory // Store transaction in memory
if ( komodo_is_notarytx(tx) == 0 )
KOMODO_ON_DEMAND++;
pool.addUnchecked(hash, entry, !IsInitialBlockDownload()); pool.addUnchecked(hash, entry, !IsInitialBlockDownload());
} }

View File

@@ -99,12 +99,18 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams,
} }
#define ASSETCHAINS_MINHEIGHT 100 #define ASSETCHAINS_MINHEIGHT 100
#define ROUNDROBIN_DELAY 45
extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE,ASSETCHAINS_SHORTFLAG,KOMODO_REALTIME;
extern char ASSETCHAINS_SYMBOL[16];
extern std::string NOTARY_PUBKEY;
extern uint8_t NOTARY_PUBKEY33[33];
uint32_t Mining_start,Mining_height;
int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33);
int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33]);
int32_t komodo_pax_opreturn(uint8_t *opret,int32_t maxsize); int32_t komodo_pax_opreturn(uint8_t *opret,int32_t maxsize);
uint64_t komodo_paxtotal(); uint64_t komodo_paxtotal();
int32_t komodo_is_issuer(); int32_t komodo_is_issuer();
int32_t komodo_gateway_deposits(CMutableTransaction *txNew,int32_t shortflag,char *symbol,int32_t tokomodo); int32_t komodo_gateway_deposits(CMutableTransaction *txNew,int32_t shortflag,char *symbol,int32_t tokomodo);
extern int32_t KOMODO_INITDONE,ASSETCHAINS_SHORTFLAG,KOMODO_REALTIME;
extern char ASSETCHAINS_SYMBOL[16];
CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
{ {
@@ -114,11 +120,10 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
if(!pblocktemplate.get()) if(!pblocktemplate.get())
return NULL; return NULL;
CBlock *pblock = &pblocktemplate->block; // pointer for convenience CBlock *pblock = &pblocktemplate->block; // pointer for convenience
//fprintf(stderr,"create new block %d\n",chainActive.Tip()->nHeight);
if ( ASSETCHAINS_SYMBOL[0] != 0 && chainActive.Tip()->nHeight >= 100 ) if ( ASSETCHAINS_SYMBOL[0] != 0 && chainActive.Tip()->nHeight >= 100 )
{ {
fprintf(stderr,"start CreateNewBlock %s initdone.%d deposit %.8f mempool.%d RT.%u\n",ASSETCHAINS_SYMBOL,KOMODO_INITDONE,(double)komodo_paxtotal()/COIN,(int32_t)mempool.GetTotalTxSize(),KOMODO_REALTIME); fprintf(stderr,"start CreateNewBlock %s initdone.%d deposit %.8f mempool.%d RT.%u KOMODO_ON_DEMAND.%d\n",ASSETCHAINS_SYMBOL,KOMODO_INITDONE,(double)komodo_paxtotal()/COIN,(int32_t)mempool.GetTotalTxSize(),KOMODO_REALTIME,KOMODO_ON_DEMAND);
while ( mempool.GetTotalTxSize() <= 0 ) while ( KOMODO_ON_DEMAND == 0 )//mempool.GetTotalTxSize() <= 0 )
{ {
deposits = komodo_paxtotal(); deposits = komodo_paxtotal();
if ( KOMODO_INITDONE == 0 || KOMODO_REALTIME == 0 ) if ( KOMODO_INITDONE == 0 || KOMODO_REALTIME == 0 )
@@ -129,6 +134,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
break; break;
sleep(10); sleep(10);
} }
KOMODO_ON_DEMAND = 0;
if ( 0 && deposits != 0 ) if ( 0 && deposits != 0 )
printf("miner KOMODO_DEPOSIT %llu pblock->nHeight %d mempool.GetTotalTxSize(%d)\n",(long long)komodo_paxtotal(),(int32_t)chainActive.Tip()->nHeight,(int32_t)mempool.GetTotalTxSize()); printf("miner KOMODO_DEPOSIT %llu pblock->nHeight %d mempool.GetTotalTxSize(%d)\n",(long long)komodo_paxtotal(),(int32_t)chainActive.Tip()->nHeight,(int32_t)mempool.GetTotalTxSize());
} }
@@ -439,13 +445,6 @@ void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&
// //
// Internal miner // Internal miner
// //
#define ROUNDROBIN_DELAY 45
extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE;
extern std::string NOTARY_PUBKEY;
extern uint8_t NOTARY_PUBKEY33[33];
uint32_t Mining_start,Mining_height;
int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33);
int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33]);
CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey)
{ {

View File

@@ -85,7 +85,7 @@ Value getinfo(const Array& params, bool fHelp)
obj.push_back(Pair("protocolversion", PROTOCOL_VERSION)); obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
obj.push_back(Pair("notarized", NOTARIZED_HEIGHT)); obj.push_back(Pair("notarized", NOTARIZED_HEIGHT));
obj.push_back(Pair("notarizedhash", NOTARIZED_HASH.ToString())); obj.push_back(Pair("notarizedhash", NOTARIZED_HASH.ToString()));
obj.push_back(Pair("notarizedbtc", NOTARIZED_DESTTXID.ToString())); obj.push_back(Pair("notarizedtxid", NOTARIZED_DESTTXID.ToString()));
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
if (pwalletMain) { if (pwalletMain) {
obj.push_back(Pair("walletversion", pwalletMain->GetVersion())); obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));