Your attack will only hit if the town stays unshielded until your troops arrive. If a peace treaty goes up, even at the very last second, your attack will bounce off.
One technique is to move your town immediately next to the target town so as to cut down the time spent marching. Another technique is to move your town to six or seven tiles away from the target and attack from there. The advantage of setting down out of the immediate sight of a player who is watching his or her own town in case of an attack is that the player is not immediately alerted as they are when an attacker suddenly appears right next to them. A third technique is to attack from far away but then to expend a considerable number of speed ups so as to hasten your attacking troops. That is the hardest attack to get a shield up against as the attackers are moving at such a fast pace by the time they reach the point that the watchtower sounds the alarm, that the defender cannot get a shield up in time. But it is costly.