From f1f6dfbb85f36aa13dc266c07bc1ada810034bc4 Mon Sep 17 00:00:00 2001 From: miketout Date: Thu, 1 Nov 2018 13:40:51 -0700 Subject: [PATCH] Don't log mempool error for staking tx, fix default destination for staking tx --- src/main.cpp | 3 +-- src/miner.cpp | 21 ++++++++++++--------- src/wallet/wallet.cpp | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index dad3ff7d1..22ee250cb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1575,8 +1575,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa CStakeParams p; if (ValidateStakeTransaction(tx, p, false)) { - return state.DoS(0, error("AcceptToMemoryPool: attempt to add staking transaction to the mempool"), - REJECT_INVALID, "staking"); + return state.DoS(0, false, REJECT_INVALID, "staking"); } // is it already in the memory pool? diff --git a/src/miner.cpp b/src/miner.cpp index 9e502badf..1327c053f 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -825,17 +825,20 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight, } else { - if (!reservekey.GetReservedKey(pubkey)) + if (!isStake) { - return NULL; + if (!reservekey.GetReservedKey(pubkey)) + { + return NULL; + } + scriptPubKey.resize(35); + ptr = (uint8_t *)pubkey.begin(); + scriptPubKey[0] = 33; + for (i=0; i<33; i++) + scriptPubKey[i+1] = ptr[i]; + scriptPubKey[34] = OP_CHECKSIG; + //scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG; } - scriptPubKey.resize(35); - ptr = (uint8_t *)pubkey.begin(); - scriptPubKey[0] = 33; - for (i=0; i<33; i++) - scriptPubKey[i+1] = ptr[i]; - scriptPubKey[34] = OP_CHECKSIG; - //scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG; } return CreateNewBlock(scriptPubKey, gpucount, isStake); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index f98cbf1b4..d9ff1d0c7 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1397,7 +1397,7 @@ int32_t CWallet::VerusStakeTransaction(CBlock *pBlock, CMutableTransaction &txNe const CKeyStore& keystore = *pwalletMain; txNew.vin.resize(1); txNew.vout.resize(1); - txfee = extendedStake ? DEFAULT_STAKE_TXFEE : 0; // extended stakes will always be rebroadcast, so they require a fee to make it fast + txfee = extendedStake ? DEFAULT_STAKE_TXFEE : 0; txNew.vin[0].prevout.hash = stakeSource.GetHash(); txNew.vin[0].prevout.n = voutNum;