Blockchain applications in vehicular networks can offer many advantages, including decentralization and improved security. However, most of the consensus algorithms in blockchain are difficult to be implemented in vehicular ad hoc networks (VANETs) without the help of edge computing services. For example, the connectivity in VANET only remains for a short period of time, which is not sufficient for highly time-consuming consensus algorithms, e.g., Proof of Work, running on mobile-edge nodes (vehicles). Other consensus algorithms also have some drawbacks, e.g., Proof of Stake (PoS) is biased toward nodes with a higher amount of stakes and Proof of Elapsed Time (PoET) is not highly secure against malicious nodes. For these reasons, we propose a voting blockchain based on the Proof-of-Quality-Factor (PoQF) consensus algorithm, where the threshold number of votes is controlled by edge computing servers. Specifically, PoQF includes voting for message validation and a competitive relay selection process based on the probabilistic prediction of channel quality between the transmitter and receiver. The performance bounds of failure and latency in message validation are obtained. This article also analyzes the throughput of block generation, as well as the asymptotic latency, security, and communication complexity of PoQF. An incentive distribution mechanism to reward honest nodes and punish malicious nodes is further presented and its effectiveness against the collusion of nodes is proved using the game theory. Simulation results show that PoQF reduces failure in validation by 11% and 15% as compared to PoS and PoET, respectively, and is 68 ms faster than PoET.