The Soviet Union must be repaid
In the early days of the Soviet-American Cold War, although the mainland was in the same camp as the Soviet Union, the Soviet Union always expected to take the initiative in Sino-Soviet relations and tried to control the mainland. It is only after decades of war that the mainland is full of deep desire for independence and self-determination, so no matter how explicitly the Soviet Union implies, we will continue to refuse. At the same time, the mainland has also seized the opportunity to continuously improve its strength.
So in the 1960s, after the Soviet Union realized that there was no hope of controlling the mainland, relations between the two countries slowly became cold, and the two sides also clashed on the border many times. Moreover, in order to contain China's development, the Soviet Union also trained Vietnam, which won the Vietnam War, as its own "thugs" and let it constantly invade and harass China.

Fight back against Vietnam
It is true that the mainland is very unhappy to be involved in the war again, but Vietnam has lost its mind, and stimulated by frequent bloodshed on the border, the mainland finally decided to fight back. However, there is a Soviet Union behind Vietnam after all, so before the return war against Vietnam, in order to prevent the Soviet Union from causing damage, the mainland also made some far-sighted deployments.
Sweet period between China and the United States
As we all know, the biggest opponent of the Soviet Union in the Cold War was the United States. As the old saying goes, the enemy of the enemy is the friend, and it is true that the mainland and the Soviet Union are not enemies, but in any case, there were still many coincidences between the mainland and the United States at that time. Therefore, in order to smoothly carry out the counterattack against Vietnam, the top leader of the mainland paid a visit to the United States in 1979.
America's ambiguous attitude
It was precisely with this visit that after the return war against Vietnam officially began, although the United States did not openly express its support for the mainland, its ambiguous attitude made the Soviet Union have to feel jealous. Moreover, the United States also promised to share intelligence with the mainland, which would make the center of gravity of the Soviet Union and the United States in Europe, and if the Soviet Union made any action, the mainland would soon receive news.
Border deployment
Secondly, before the return war against Vietnam began, China and the Soviet Union almost fought on the border. Therefore, in order to take precautions, in addition to strengthening the fortifications on the Sino-Soviet border, the mainland also sent a large number of troops. In short, even if the Soviet Union suddenly attacked the north of the mainland, our deployment on the border was enough to withstand the Soviet offensive, and there was no possibility of being caught between two sides.
Strategize
Finally, in order to quickly resolve the battle, the mainland invested troops and equipment in the preparation before the war can be called "slaughtering cattle knives" to kill chickens. According to the mainland's analysis of the Soviet Union, if the Soviet Union did intervene in the war, it would take at least a month to send troops from Europe to the Eastern Front, and in this time, the mainland was fully capable of completing the lessons learned from Vietnam.
Obviously, the mainland has returned home victorious after fighting Vietnam, and the Soviet Union has not made any moves, and it has to be said that the Soviet Union can be so peaceful, and China's deployment in advance is indispensable. Moreover, the Soviet Union also knew that the contradictions between China and the Soviet Union were not irreconcilable, and that the Soviet Union gave up on making bad things out of consideration and the fact that the mainland was still fully prepared.