Skip to content

Commit

Permalink
Add P2WSH handling to wallet database (#1107)
Browse files Browse the repository at this point in the history
* Add createrawtransaction RPC method

* Better handling of Sequence field, and safer defaults

* Fix case where fundrawtransaction is called for the watch-only account

* Add protocol version overloads for CreateTransaction

* Check that createrawtransaction RPC client works for SFN/bitcoind

* Modify createrawtransaction RPC to return string response

* Fix RPC middleware to correctly handle non-JSON RPC responses

* Remove accidental duplication

* Fix test

* Revert middleware change and add additional test

* Add P2WSH handling to wallet database
  • Loading branch information
zeptin authored Jan 20, 2023
1 parent 7a5d548 commit 2f7e971
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,19 @@ internal IEnumerable<TxDestination> GetDestinations(Script redeemScript)
case TxOutType.TX_SEGWIT:
TxDestination txDestination = PayToWitTemplate.Instance.ExtractScriptPubKeyParameters(this.network, redeemScript);
if (txDestination != null)
yield return new KeyId(txDestination.ToBytes());
{
if (txDestination.ToBytes().Length == 20)
{
yield return PayToWitPubKeyHashTemplate.Instance.ExtractScriptPubKeyParameters(this.network, redeemScript);
}
else if (txDestination.ToBytes().Length == 32)
{
yield return PayToWitScriptHashTemplate.Instance.ExtractScriptPubKeyParameters(this.network, redeemScript);
}

// This should not happen, segwit scripts should generally only have one of the two valid lengths.
yield return txDestination;
}
break;
default:
if (this.scriptAddressReader is ScriptDestinationReader scriptDestinationReader)
Expand Down

0 comments on commit 2f7e971

Please sign in to comment.