diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 8149132..33a85bb 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -310,12 +310,12 @@ class CTestNetParams : public CChainParams { vFixedSeeds.clear(); vSeeds.clear(); // nodes with support for servicebits filtering should be at the top - /*vSeeds.emplace_back("92.60.46.26"); + vSeeds.emplace_back("92.60.46.26"); vSeeds.emplace_back("92.60.46.27"); vSeeds.emplace_back("92.60.46.28"); vSeeds.emplace_back("92.60.46.29"); vSeeds.emplace_back("92.60.46.30"); - vSeeds.emplace_back("92.60.46.31");*/ + vSeeds.emplace_back("92.60.46.31"); base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,111); base58Prefixes[SCRIPT_ADDRESS] = std::vector(1,196); diff --git a/src/masternode/masternode-payments.cpp b/src/masternode/masternode-payments.cpp index 4226030..d656027 100755 --- a/src/masternode/masternode-payments.cpp +++ b/src/masternode/masternode-payments.cpp @@ -135,7 +135,7 @@ bool CMasternodePayments::CanVote(COutPoint outMasternode, int nBlockHeight) return true; } -void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees) +void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees, bool hasMNPayment) { CBlockIndex* pindexPrev = ::ChainActive().Tip(); if(!pindexPrev) return; @@ -145,7 +145,7 @@ void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees) } else if(IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(pindexPrev->nHeight+1)){ budget.FillBlockPayee(txNew, nFees); } else { - masternodePayments.FillBlockPayee(txNew, nFees); + masternodePayments.FillBlockPayee(txNew, nFees, hasMNPayment); } } @@ -160,12 +160,12 @@ std::string GetRequiredPaymentsString(int nBlockHeight) } } -void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int64_t nFees) +void CMasternodePayments::FillBlockPayee(CMutableTransaction& txNew, int64_t nFees, bool hasPayment) { CBlockIndex* pindexPrev = ::ChainActive().Tip(); if(!pindexPrev) return; - bool hasPayment = true; + //bool hasPayment = true; CScript payee; //spork diff --git a/src/masternode/masternode-payments.h b/src/masternode/masternode-payments.h index de533af..060ee13 100755 --- a/src/masternode/masternode-payments.h +++ b/src/masternode/masternode-payments.h @@ -30,7 +30,7 @@ bool IsReferenceNode(CTxIn& vin); bool IsBlockPayeeValid(const CAmount& nValueCreated, const CTransaction& txNew, int nBlockHeight, const uint32_t& nTime, const uint32_t& nTimePrevBlock); std::string GetRequiredPaymentsString(int nBlockHeight); bool IsBlockValueValid(const CBlock& block, int64_t nExpectedValue); -void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees); +void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees, bool hasMNPayment); class CMasternodePayee { @@ -224,7 +224,7 @@ class CMasternodePayments int GetMinMasternodePaymentsProto(); void ProcessMessageMasternodePayments(CNode* pfrom, const std::string& strCommand, CDataStream& vRecv); std::string GetRequiredPaymentsString(int nBlockHeight); - void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees); + void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees, bool hasMNPayment); std::string ToString() const; int GetOldestBlock(); int GetNewestBlock(); diff --git a/src/miner.cpp b/src/miner.cpp index adcdc09..6bc2cbe 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -203,8 +203,9 @@ std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& sc // Masternode and general budget payments if (IsSporkActive(SPORK_4_ENABLE_MASTERNODE_PAYMENTS) || Params().NetworkIDString() == CBaseChainParams::TESTNET) { - FillBlockPayee(coinbaseTx, nFees); - SNFillBlockPayee(coinbaseTx, nFees); + bool hasMNPayment =true; + FillBlockPayee(coinbaseTx, nFees, hasMNPayment); + SNFillBlockPayee(coinbaseTx, nFees, hasMNPayment); } else { diff --git a/src/rpc/contracts.cpp b/src/rpc/contracts.cpp index 2d98f1c..2c75c6f 100755 --- a/src/rpc/contracts.cpp +++ b/src/rpc/contracts.cpp @@ -88,16 +88,7 @@ static RPCHelpMan getcontracts() for(auto s : allcontracts){ UniValue entry(UniValue::VOBJ); - - entry.pushKV("url", s.contract_url); - entry.pushKV("name", s.asset_name); - entry.pushKV("symbol", s.asset_symbol); - entry.pushKV("issuing address", s.sIssuingaddress); - entry.pushKV("description", s.description); - entry.pushKV("website", s.website_url); - entry.pushKV("script", HexStr(s.scriptcode)); - entry.pushKV("signature", HexStr(s.vchContractSig)); - + ContractToUniv(s,entry); result.push_back(entry); } @@ -127,16 +118,7 @@ static RPCHelpMan getcontract() { const CContract &s = GetContract(request.params[0].get_str()); UniValue result(UniValue::VOBJ); - - result.pushKV("url", s.contract_url); - result.pushKV("name", s.asset_name); - result.pushKV("symbol", s.asset_symbol); - result.pushKV("issuing address", s.sIssuingaddress); - result.pushKV("description", s.description); - result.pushKV("website", s.website_url); - result.pushKV("script", HexStr(s.scriptcode)); - result.pushKV("signature", HexStr(s.vchContractSig)); - //ContractToUniv(contract,result); + ContractToUniv(s,result); return result; }, @@ -323,24 +305,8 @@ static RPCHelpMan getassets() UniValue result(UniValue::VARR); for(auto asset : allassets){ - UniValue entry(UniValue::VOBJ); - - entry.pushKV("version", (int)asset.nVersion); - uint32_t type = asset.GetType(); - entry.pushKV("type", AssetTypeToString(type)); - entry.pushKV("name", asset.getAssetName()); - entry.pushKV("symbol", asset.getShortName()); - entry.pushKV("id", asset.GetHex()); - entry.pushKV("contract_hash", asset.contract_hash.GetHex()); - entry.pushKV("expiry", (int64_t)asset.GetExpiry()); - entry.pushKV("transferable", asset.isTransferable() ? "yes" : "no"); - entry.pushKV("convertable", asset.isConvertable() ? "yes" : "no"); - entry.pushKV("limited", asset.isLimited() ? "yes" : "no"); - entry.pushKV("restricted", asset.isRestricted() ? "yes" : "no"); - entry.pushKV("stakeable", asset.isStakeable() ? "yes" : "no"); - entry.pushKV("inflation", asset.isInflatable() ? "yes" : "no"); - + AssetToUniv(asset,entry); result.push_back(entry); } @@ -367,8 +333,10 @@ static RPCHelpMan getnumassets() [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { std::vector allassets = ::GetAllAssets(); + std::vector allcontracts = ::GetAllContracts(); UniValue deets(UniValue::VOBJ); deets.pushKV("Asset count", allassets.size()); + deets.pushKV("Contract count", allcontracts.size()); return deets; }, diff --git a/src/systemnode/systemnode-payments.cpp b/src/systemnode/systemnode-payments.cpp index 4cf32d0..302fb61 100755 --- a/src/systemnode/systemnode-payments.cpp +++ b/src/systemnode/systemnode-payments.cpp @@ -178,7 +178,7 @@ bool CSystemnodePayments::CanVote(COutPoint outSystemnode, int nBlockHeight) return true; } -void SNFillBlockPayee(CMutableTransaction& txNew, int64_t nFees) +void SNFillBlockPayee(CMutableTransaction& txNew, int64_t nFees, bool hasMNPayment) { CBlockIndex* pindexPrev = ::ChainActive().Tip(); if (!pindexPrev) @@ -188,7 +188,7 @@ void SNFillBlockPayee(CMutableTransaction& txNew, int64_t nFees) } else if (IsSporkActive(SPORK_13_ENABLE_SUPERBLOCKS) && budget.IsBudgetPaymentBlock(pindexPrev->nHeight + 1)) { // Doesn't pay systemnode, miners get the full amount on these blocks } else { - systemnodePayments.FillBlockPayee(txNew, nFees); + systemnodePayments.FillBlockPayee(txNew, nFees, hasMNPayment); } } @@ -204,7 +204,7 @@ std::string SNGetRequiredPaymentsString(int nBlockHeight) } } -void CSystemnodePayments::FillBlockPayee(CMutableTransaction& txNew, int64_t nFees) +void CSystemnodePayments::FillBlockPayee(CMutableTransaction& txNew, int64_t nFees, bool hasMNPayment) { CBlockIndex* pindexPrev = ::ChainActive().Tip(); if(!pindexPrev) return; @@ -252,6 +252,18 @@ void CSystemnodePayments::FillBlockPayee(CMutableTransaction& txNew, int64_t nFe LogPrint(BCLog::NET, "Systemnode payment to %s\n", EncodeDestination(address1)); } + + if(!hasMNPayment && hasPayment){ + if(txNew.nVersion >= TX_ELE_VERSION){ + txNew.vpout[1].scriptPubKey = payee; + txNew.vpout[1].nValue = 0; + txNew.vpout[1].nAsset = Params().GetConsensus().subsidy_asset; + } + else{ + txNew.vout[1].scriptPubKey = payee; + txNew.vout[1].nValue = 0; + } + } } std::string CSystemnodeBlockPayees::GetRequiredPaymentsString() diff --git a/src/systemnode/systemnode-payments.h b/src/systemnode/systemnode-payments.h index 52cb248..7469265 100755 --- a/src/systemnode/systemnode-payments.h +++ b/src/systemnode/systemnode-payments.h @@ -25,7 +25,7 @@ extern CSystemnodePayments systemnodePayments; #define SNPAYMENTS_SIGNATURES_TOTAL 10 #define SN_PMT_SLOT 2 -void SNFillBlockPayee(CMutableTransaction& txNew, int64_t nFees); +void SNFillBlockPayee(CMutableTransaction& txNew, int64_t nFees, bool hasMNPayment); bool SNIsBlockPayeeValid(const CAmount& nValueCreated, const CTransaction& txNew, int nBlockHeight, const uint32_t& nTime, const uint32_t& nTimePrevBlock); std::string SNGetRequiredPaymentsString(int nBlockHeight); @@ -216,7 +216,7 @@ class CSystemnodePayments bool IsScheduled(CSystemnode& sn, int nNotBlockHeight); bool CanVote(COutPoint outSystemnode, int nBlockHeight); std::string GetRequiredPaymentsString(int nBlockHeight); - void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees); + void FillBlockPayee(CMutableTransaction& txNew, int64_t nFees, bool hasMNPayment); std::string ToString() const; SERIALIZE_METHODS(CSystemnodePayments, obj)