From 1d61a65ec3c044b9fffbb952c34dee075d370cf6 Mon Sep 17 00:00:00 2001 From: Giacomo Milligan Date: Wed, 21 Apr 2021 14:37:03 +0200 Subject: [PATCH] [PoS] Small changes/typos --- src/consensus/merkle.cpp | 2 +- src/rpc/blockchain.cpp | 4 ++-- src/wallet/rpcwallet.cpp | 2 ++ src/wallet/wallet.cpp | 5 ++++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/consensus/merkle.cpp b/src/consensus/merkle.cpp index bc40d03216f80..23e9b863afdf2 100644 --- a/src/consensus/merkle.cpp +++ b/src/consensus/merkle.cpp @@ -82,7 +82,7 @@ uint256 BlockWitnessMerkleRoot(const CBlock& block, bool* mutated, bool *pfProof leaves[0].SetNull(); // The witness hash of the coinbase (index 0) is 0. if (fProofOfStake) { - leaves[1].SetNull(); // The witness hash of the coinbase (index 1) is 0. + leaves[1].SetNull(); // The witness hash of the coinstake (index 1) is 0. } for (size_t s = 1 + (fProofOfStake ? 1 : 0); s < block.vtx.size(); s++) { //Make sure we're using the right index. leaves[s] = block.vtx[s]->GetWitnessHash(); diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index cdc17829cd02d..574ce363694cb 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1822,8 +1822,8 @@ static inline bool SetHasKeys(const std::set& set, const Tk& key, const Args& return (set.count(key) != 0) || SetHasKeys(set, args...); } -// outpoint (needed for the utxo index) + nHeight + fCoinBase -static constexpr size_t PER_UTXO_OVERHEAD = sizeof(COutPoint) + sizeof(uint32_t) + sizeof(bool); +// outpoint (needed for the utxo index) + nHeight + fCoinBase + fCoinStake +static constexpr size_t PER_UTXO_OVERHEAD = sizeof(COutPoint) + sizeof(uint32_t) + sizeof(bool) + sizeof(bool); static RPCHelpMan getblockstats() { diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 9cc01aab049dd..e7981c069c377 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1364,6 +1364,8 @@ static void ListTransactions(const CWallet* const pwallet, const CWalletTx& wtx, { if (wtx.GetDepthInMainChain() < 1) entry.pushKV("category", "orphan stake"); + else if (wtx.IsImmatureCoinBase()) + entry.pushKV("category", "immature"); else entry.pushKV("category", "minted"); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 1b2f51fa7a379..f2ffc816a46d1 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1936,6 +1936,9 @@ bool CWalletTx::SubmitMemoryPoolAndRelay(std::string& err_string, bool relay) // Don't try to submit coinbase transactions. These would fail anyway but would // cause log spam. if (IsCoinBase()) return false; + // Don't try to submit coinstake transactions. These would fail anyway but would + // cause log spam. + if (IsCoinStake()) return false; // Don't try to submit conflicted or confirmed transactions. if (GetDepthInMainChain() != 0) return false; @@ -2643,7 +2646,7 @@ bool CWallet::SignTransaction(CMutableTransaction& tx) const return false; } const CWalletTx& wtx = mi->second; - coins[input.prevout] = Coin(wtx.tx->vout[input.prevout.n], wtx.m_confirm.block_height, wtx.IsCoinBase(), wtx.IsCoinBase()); + coins[input.prevout] = Coin(wtx.tx->vout[input.prevout.n], wtx.m_confirm.block_height, wtx.IsCoinBase(), wtx.IsCoinStake()); } std::map input_errors; return SignTransaction(tx, coins, SIGHASH_ALL, input_errors);