writeMessage method
Send a wire protocol message to the peer
Implementation
@override
Future<void> writeMessage(WireMessage msg) async {
if (!connected) {
throw ConnectionException('Peer is not connected');
}
try {
await _connection!.sendMessage(msg);
_messagesSent++;
logger.fine('Sent ${msg.command} message to peer');
} catch (e) {
logger.warning('Failed to send ${msg.command} message: $e');
_increaseUnhealthyScore(1);
rethrow;
}
}