Honestly, you don't have to consent to search. I don't care what anyone read. If a cops ASKS for your permission, he is doing it for a reason. If it were true that he could automaticaly search you, he would have done it without asking your permission.

Now that you are in this situation, I can only tell you what I would have done.

I would have came back to the cop in two weeks, and told him "Fuckyou McSwiggens" sold me the weed, do your worst.

This sounds like the type of cop that does not deserve respect. I always say respect the cops until the show that they don't deserve it. If he was going to take action against you, he should have done it right there. How would he explain to his superiors that he busted some highschool punk with a few bits of weed, but didn't do anything right there?

Let them do their worst I say, it's only a few pieces of weed, snitching will bring you a world of trouble, trust me.