<p>I submitted a new block using the rpc command <code>submit</code>. And I just got a "reject" string without a reject reason.</p>

<p>I checked the bitcoind source code, and found that it usually sends a reject reason; bitcoind would only omit a reason if the <code>strRejectReason</code> is empty. Why and when would the <code>strRejectReason</code> be empty?</p>

<pre><code>static Value BIP22ValidationResult(const CValidationState&amp; state)
{
    if (state.IsValid())
        return Value::null;

    std::string strRejectReason = state.GetRejectReason();
    if (state.IsError())
        throw JSONRPCError(RPC_VERIFY_ERROR, strRejectReason);
    if (state.IsInvalid())
    {
        if (strRejectReason.empty())
            return "rejected"; // The value that gets returned
        return strRejectReason;
    }
    // Should be impossible
    return "valid?";
}
</code></pre>

<p><a href="https://github.com/bitcoin/bitcoin/blob/f914f1a746d7f91951c1da262a4a749dd3ebfa71/src/rpcmining.cpp#L302" rel="nofollow">Source.</a></p>

CC BY-SA 3.0
2014-12-19T19:23:50.280Z
Are you using the command `submit` (which doesn't exist, I think) the command `submitblock`, or `getblocktemplate` with the mode argument set to `proposal`?
Nick ODell
CC BY-SA 3.0
2014-12-19T20:23:26.473Z
Does the source of `CValidationState::GetRejectReason` have anything useful?
Nate Eldredge
CC BY-SA 3.0
2014-12-19T21:11:30.250Z
Which version of the source code? There have been recent changes in this area.
Pieter Wuille
<bitcoind><json-rpc>
When does the "reject" string have an empty reject reason upon submitting a new block?
Eleven
# When does the "reject" string have an empty reject reason upon submitting a new block?

(Asked by: username_0 on 2014-12-13)

I submitted a new block using the rpc command `submit`. And I just got a "reject" string without a reject reason.

I checked the bitcoind source code, and found that it usually sends a reject reason; bitcoind would only omit a reason if the `strRejectReason` is empty. Why and when would the `strRejectReason` be empty?

```
static Value BIP22ValidationResult(const CValidationState& state)
{
    if (state.IsValid())
        return Value::null;

    std::string strRejectReason = state.GetRejectReason();
    if (state.IsError())
        throw JSONRPCError(RPC_VERIFY_ERROR, strRejectReason);
    if (state.IsInvalid())
    {
        if (strRejectReason.empty())
            return "rejected"; // The value that gets returned
        return strRejectReason;
    }
    // Should be impossible
    return "valid?";
}

```

[Source.](https://github.com/bitcoin/bitcoin/blob/f914f1a746d7f91951c1da262a4a749dd3ebfa71/src/rpcmining.cpp#L302)

**Tags:** bitcoind, json-rpc

> **Comments:**
> **username_1**: Are you using the command `submit` (which doesn't exist, I think) the command `submitblock`, or `getblocktemplate` with the mode argument set to `proposal`?  
> **username_2**: Does the source of `CValidationState::GetRejectReason` have anything useful?  
> **username_3**: Which version of the source code? There have been recent changes in this area.  

---

## 0 answers

