TransactionBuilder to correctly handle non-zero vin in inputs

Fixes #269.

**edit**: Although not directly related, I've gone ahead and added several other error-handling commits to make debugging of complicated situations like this much simpler, and naturally added tests for these situations also.