Steps:
1. Send transaction (A) to a different wallet
2. Using the change, create another transaction (B) to a different wallet
3. `abandontransaction` B
4. `bumpfee` A fails with `Transaction has descendants in the wallet`
{
    AssertLockHeld(cs_);
    if (auto* conf = wtx.state<TxStateConfirmed>()) {
        return GetLastBlockHeight() - conf->confirmed_block_height + 1;
    } else if (auto* conf = wtx.state<TxStateConflicted>()) {
        return -1 * (GetLastBlockHeight() - conf->conflicting_block_height + 1);
    } else {
        return 0;
    }
}
int CWalletGetTxBlocksToMaturity(const CWalletTx& wtx) const
{
    AssertLockHeld(cs_);
    if (!wtx.IsCoinBase()) {
        return 0;
    }
    int chain_depth = GetTxDepthInMainChain(wtx);
    assert(chain_depth >= 0); // coinbase tx should not be conflicted
    return stdmax(0, (COINBASE_MATURITY+1) - chain_depth);
}
bool CWalletIsTxImmatureCoinBase(const CWalletTx& wtx) const
{
    AssertLockHeld(cs_);
    // note GetBlocksToMaturity is 0 for non-coinbase tx
    return GetTxBlocksToMaturity(wtx) > 0;
}
bool CWalletIsCrypted() const
{
    return HasEncryptionKeys();
}