Answer:
Both – it was the offering AND the condition of the heart.
Cain did not offer a blood sacrifice as Abel did…yet God had instructed it was by blood that man could be saved and it was a sign of what someday His only Son would do. By Cain not offering a blood offering it was like discounting the work that Christ was to someday do on the cross. That is why the offering was rejected.
BUT, God gave Cain another chance and told him to go and make the proper offering. God forgave Cain and provided a means for him to come into a right relationship with God. Instead, Cain hardened his heart and decided to offer up some blood…but not of a sacrifice to God but in taking out his rebellion on his brother!!!!
It is sad to think that god is always more willing to forgive and offer another chance than we are to take it.