Why does WOTS+ need a checksum during signing operation? I was reviewing WOTS+ scheme for consideration in our private blockchain, and noticed that it had a small overhead of calculating a checksum as seen in the following pseudocode excerpt from the SPHINCS+ submission to NIST

wots_sign(M, SK.seed, PK.seed, ADRS) {
  csum = 0;

  // convert message to base w
  msg = base_w(M, w, len_1);

  // **compute checksum** &lt;&lt;&lt;&lt;============
  for ( i = 0; i &lt; len_1; i++ ) {
    csum = csum + w - 1 - msg[i];
  }

  // convert csum to base w
  csum = csum &lt;&lt; ( 8 - ( ( len_2 * lg(w) ) % 8 ));
  len_2_bytes = ceil( ( len_2 * lg(w) ) / 8 );
  msg = msg || base_w(toByte(csum, len_2_bytes), w, len_2);
  for ( i = 0; i &lt; len; i++ ) {
    ADRS.setChainAddress(i);
    sk = PRF(SK.seed, ADRS);
    sig[i] = chain(sk, 0, msg[i], PK.seed, ADRS);
  }
  return sig;
}
//Algorithm 5: wots_sign – Generating a WOTS+ signature on a message M.


Why is it there? Is it necessary for the security of the scheme? 

Update

According to "On the Security of the Winternitz One-Time Signature Scheme", the checksum deters "second-key" and "key-collision" attack should there be a functional forgery oracle. How relevant an attack is it to WOTS+ and to other regular signature schemes?
To understand why we need a "checksum", we can take a look all the way back to 1979 paper "A Certified Digital Signature" by Raphle Merkle. 

From page 14 on the treatment of the Lamport-Diffie OTS: 


  The method as described thus far suffers from the defect that B can alter m by changing bits that are 1's into 0's. ... However, 0's cannot be changed to 1's.


This is because, if one changes 1 to 0, she/he can simply calculate the image of the hash for that bit and get another valid signature. 

The countermeasure as proposed was, quote: 


  by signing a new message m', which is exactly twice as long as m and is computed by concatenating m with the bitwise complement of m.


The similar method was used in WOTS, except instead of concatenating m with its bitwise complement, it's concatenated with the "additive" complement of the sum of its indicies. 

So this is more like a padding scheme (similar in purpose to that used in RSA), but since it's a number, we'll just call it a checksum. 

As to the update in OP, the checksum also plays an important role in the provable security reduction of WOTS.