tests: remove extraneous anonymous function
TxBuilder: extract ExtractSignatures to free function
TxBuilder: re-order to avoid mutation in case of failure
TxBuilder: sign now signs inputs in known publicKey order