code: func (msg *sentMessage) sign(key *ecdsa.PrivateKey) error {
  	if isMessageSigned(msg.Raw[0]) {
  		// this should not happen, but no reason to panic
  		log.Error("failed to sign the message: already signed")
  		return nil
  	}
  
  	msg.Raw[0] |= signatureFlag // it is important to set this flag before signing
  	hash := crypto.Keccak256(msg.Raw)
  	signature, err := crypto.Sign(hash, key)
  	if err != nil {
  		msg.Raw[0] &= (0xFF ^ signatureFlag) // clear the flag
  		return err
  	}
  	msg.Raw = append(msg.Raw, signature...)
  	return nil
  }
docs: // sign calculates and sets the cryptographic signature for the message,
  // also setting the sign flag.