Vakil exercise 17.4.D: different notions of degree of a finite morphism We have a finite morphism $\pi: C \rightarrow C'$ between two regular integral curves over a field $k$. On the previous page, Vakil proves that such a morphism has a well defined rank defined as the rank of locally free sheaf $\pi_{*} \mathcal{O}_C$. Now we have to show that the degree can also be computed as follows:

Let $p$ be a closed point in $C'$, and let $\pi^{-1}(p) = \{p_1, ..., p_m\}$. If $t$ is a uniformizer of the DVR $\mathcal{O}_{C',p}$, then show that $$\text{deg} \pi = \sum_{i=1}^m (\text{val}_{p_i} \, \pi^*t) \,\,\text{deg}(k(p_i)/k(p))$$

With standard reductions we have that the map corresponds to injective ring map $f: B \rightarrow A$ where $A$ and $B$ are Dedekind domains and $p$ corresponds to a maximal ideal of $B$ such that its uniformizer $t$ is a regular function of $\text{Spec} B$.  With this terminology, $\pi^* t$ is simply $f(t)$.  I am stuck at this point. This sounds like the situation of splitting of primes in basic number theory, but since Vakil hasn't talked about that I am wondering If there is a straightforward way to do it.
 A: Let $\operatorname{Spec} A\subset C'$ be an affine open subset where $f_*\mathcal{O}_{C}$ is free of rank $r$. Let $\operatorname{Spec} B=f^{-1}(\operatorname{Spec} A)$. Then $(f_*\mathcal{O}_C)(\operatorname{Spec} A)\cong B$, but on the other hand, since $f_*\mathcal{O}_C$ is free of rank $r$ over $\operatorname{Spec} A$, we have that $(f_*\mathcal{O}_C)(\operatorname{Spec} A)\cong A^r$. So $A^r\cong B$ as $A$-modules, and therefore for a closed point $p\in C'$ we have that $A^r\otimes_A k(p)\cong B\otimes_A k(p)$ as $k(p)$-modules. The $k(p)$-dimension of the LHS is $r$, while the dimension of the RHS is exactly the quantity you're interested in.
To see this, suppose $t\in A$ is a uniformizer for $\mathcal{O}_{C',p}$. Then $k(p)\cong A/t$, and $B\otimes_A k(p)\cong B/f^*t$. As $f^*t$ vanishes exactly on the finite set of preimages of $p$, we have that $B/f^*t\cong \prod_{q\mapsto p} \mathcal{O}_{C,p}/f^*t$: the LHS is the global sections of the sheaf $\widetilde{B/f^*t}$ on $\operatorname{Spec} B$, while the RHS is the product of the stalks, and these quantities are equal for sheaves with discrete support. Next, $\dim_{k(p)} \mathcal{O}_{C,q}/f^*t = \dim_{k(p)} k(q)^{\operatorname{val}_q f^*t} = (\operatorname{val}_q f^*t)\cdot[k(q):k(p)]$ and summing, we have the result.
