Skip to content

Commit

Permalink
[PoS] Small changes/typos
Browse files Browse the repository at this point in the history
  • Loading branch information
giaki3003 committed Apr 21, 2021
1 parent 6c1ae0a commit 1d61a65
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/consensus/merkle.cpp
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/rpc/blockchain.cpp
Expand Up @@ -1822,8 +1822,8 @@ static inline bool SetHasKeys(const std::set<T>& 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()
{
Expand Down
2 changes: 2 additions & 0 deletions src/wallet/rpcwallet.cpp
Expand Up @@ -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");
}
Expand Down
5 changes: 4 additions & 1 deletion src/wallet/wallet.cpp
Expand Up @@ -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;

Expand Down Expand Up @@ -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<int, std::string> input_errors;
return SignTransaction(tx, coins, SIGHASH_ALL, input_errors);
Expand Down

0 comments on commit 1d61a65

Please sign in to comment.