No constable shall buy, or become interested by contract in, any claim against another put into his hands for collection. Any such purchase or contract may be relied on by a defendant in bar of a suit on such claim, or as a ground for vacating a judgment or quashing an execution thereon.