private static void writeStatusOrStateRoot(
      final TransactionReceipt receipt, final RLPOutput output) {
    // Determine whether it's a state root-encoded transaction receipt
    // or is a status code-encoded transaction receipt.
    if (receipt.getStateRoot() != null) {
      output.writeBytes(receipt.getStateRoot());
    } else {
      output.writeLongScalar(receipt.getStatus());
    }
  }
Writes the status or state root of the transaction receipt to the output.

@param receipt the transaction receipt
@param output the RLP output
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/receipt/TransactionReceiptEncoder.java