mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 19:37:27 -03:00
psbt: Actually use SIGHASH_DEFAULT
Make the behavior align with the help text by actually using SIGHASH_DEFAULT as the default sighash for signing PSBTs.
This commit is contained in:
parent
eb9a1a2c59
commit
d3992669df
4 changed files with 6 additions and 6 deletions
|
@ -248,7 +248,7 @@ std::vector<unsigned char> ParseHexUV(const UniValue& v, const std::string& strN
|
|||
|
||||
int ParseSighashString(const UniValue& sighash)
|
||||
{
|
||||
int hash_type = SIGHASH_ALL;
|
||||
int hash_type = SIGHASH_DEFAULT;
|
||||
if (!sighash.isNull()) {
|
||||
static std::map<std::string, int> map_sighash_values = {
|
||||
{std::string("DEFAULT"), int(SIGHASH_DEFAULT)},
|
||||
|
|
|
@ -236,7 +236,7 @@ public:
|
|||
/** Sign a message with the given script */
|
||||
virtual SigningResult SignMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) const { return SigningResult::SIGNING_FAILED; };
|
||||
/** Adds script and derivation path information to a PSBT, and optionally signs it. */
|
||||
virtual TransactionError FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, int sighash_type = 1 /* SIGHASH_ALL */, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr, bool finalize = true) const { return TransactionError::INVALID_PSBT; }
|
||||
virtual TransactionError FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, int sighash_type = SIGHASH_DEFAULT, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr, bool finalize = true) const { return TransactionError::INVALID_PSBT; }
|
||||
|
||||
virtual uint256 GetID() const { return uint256(); }
|
||||
|
||||
|
@ -400,7 +400,7 @@ public:
|
|||
|
||||
bool SignTransaction(CMutableTransaction& tx, const std::map<COutPoint, Coin>& coins, int sighash, std::map<int, bilingual_str>& input_errors) const override;
|
||||
SigningResult SignMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) const override;
|
||||
TransactionError FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, int sighash_type = 1 /* SIGHASH_ALL */, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr, bool finalize = true) const override;
|
||||
TransactionError FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, int sighash_type = SIGHASH_DEFAULT, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr, bool finalize = true) const override;
|
||||
|
||||
uint256 GetID() const override;
|
||||
|
||||
|
@ -609,7 +609,7 @@ public:
|
|||
|
||||
bool SignTransaction(CMutableTransaction& tx, const std::map<COutPoint, Coin>& coins, int sighash, std::map<int, bilingual_str>& input_errors) const override;
|
||||
SigningResult SignMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) const override;
|
||||
TransactionError FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, int sighash_type = 1 /* SIGHASH_ALL */, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr, bool finalize = true) const override;
|
||||
TransactionError FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, int sighash_type = SIGHASH_DEFAULT, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr, bool finalize = true) const override;
|
||||
|
||||
uint256 GetID() const override;
|
||||
|
||||
|
|
|
@ -561,7 +561,7 @@ public:
|
|||
*/
|
||||
TransactionError FillPSBT(PartiallySignedTransaction& psbtx,
|
||||
bool& complete,
|
||||
int sighash_type = 1 /* SIGHASH_ALL */,
|
||||
int sighash_type = SIGHASH_DEFAULT,
|
||||
bool sign = true,
|
||||
bool bip32derivs = true,
|
||||
size_t* n_signed = nullptr,
|
||||
|
|
|
@ -457,7 +457,7 @@ class PSBTTest(BitcoinTestFramework):
|
|||
wrpc = self.nodes[2].get_wallet_rpc("wallet{}".format(i))
|
||||
for key in signer['privkeys']:
|
||||
wrpc.importprivkey(key)
|
||||
signed_tx = wrpc.walletprocesspsbt(signer['psbt'])['psbt']
|
||||
signed_tx = wrpc.walletprocesspsbt(signer['psbt'], True, "ALL")['psbt']
|
||||
assert_equal(signed_tx, signer['result'])
|
||||
|
||||
# Combiner test
|
||||
|
|
Loading…
Reference in a new issue