Blockchain technology has wide applications in the fields of finance, public welfare, and the Internet of Things. Owing to a blockchain's characteristics, which include decentralization, openness, autonomy, immutability, and anonymity, it is difficult to quickly reach a reliable consensus result among its nodes. This work proposes a performance-optimized consensus mechanism based on node classification. Nodes are classified into accounting, validating, and propagating ones based on their trust values. All accounting nodes form an accounting node group, from which one is selected as the current accounting node to package transactions into a block, and the remaining nodes in the accounting node group can be used to validate the block quickly, owing to their high trust values. Validating and propagating nodes are responsible for validating and propagating transactions, respectively. All nodes' trust values are dynamically updated according to their behavior and performance. Corresponding algorithms are designed to realize the proposed consensus mechanism. The experimental results show that the proposed consensus mechanism provides higher throughput, lower consumption, and higher fault tolerance than some popularly used methods, thereby advancing the field of consortium blockchains.