Skip to content

Commit

Permalink
Error on incorrect address prefixes
Browse files Browse the repository at this point in the history
Fixes a bug whereby passing an address with the wrong network prefix
results in a transaction with an empty scriptPubKey and no error.

Such transactions are non standard and won't be accepted on mainnet or
regtest but are accepted in testnet.
  • Loading branch information
jkauffman1 authored and jgriffiths committed Jan 21, 2021
1 parent b99c725 commit cc66a5a
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/transaction_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ std::vector<unsigned char> output_script_for_address(
return scriptpubkey_p2pkh_from_hash160(script_hash);
}

error = res::id_invalid_address;
return std::vector<unsigned char>();
}

Expand Down

0 comments on commit cc66a5a

Please sign in to comment.