Skip to content

Commit

Permalink
hard-code sighash type
Browse files Browse the repository at this point in the history
  • Loading branch information
dannydeezy committed Apr 26, 2023
1 parent ed2a2e9 commit 7b15a17
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/psbt.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function createPsbtForBoost({ utxo, inputAddressInfo, destinationBtcAddress }) {
const network = TESTNET ? bitcoin.networks.testnet : bitcoin.networks.bitcoin;

const psbt = new bitcoin.Psbt({ network });
const sighashType = 131 // bitcoin.Transaction.SIGHASH_SINGLE | bitcoin.Transaction.SIGHASH_ANYONECANPAY;
const sighashType = 131; // bitcoin.Transaction.SIGHASH_SINGLE | bitcoin.Transaction.SIGHASH_ANYONECANPAY;
const inputParams = getInputParams({ utxo, inputAddressInfo, sighashType });
const output = 10000; // TODO: make this a constant.
psbt.addOutput({
Expand Down Expand Up @@ -145,7 +145,7 @@ export async function signAndBroadcastUtxo({ pubKey, utxo, destinationBtcAddress
export async function createAndSignPsbtForBoost({ pubKey, utxo, destinationBtcAddress }) {
const inputAddressInfo = getAddressInfo(pubKey);
const { psbt, inputParams } = createPsbtForBoost({ utxo, inputAddressInfo, destinationBtcAddress });
const sighashType = 131 // bitcoin.Transaction.SIGHASH_SINGLE | bitcoin.Transaction.SIGHASH_ANYONECANPAY;
const sighashType = 131; // bitcoin.Transaction.SIGHASH_SINGLE | bitcoin.Transaction.SIGHASH_ANYONECANPAY;
const signed = await getSignedPsbt({ psbt, inputParams, inputAddressInfo, utxo, sighashType });
// Finalize the PSBT. Note that the transaction will not be broadcast to the Bitcoin network yet.
signed.finalizeAllInputs();
Expand Down

0 comments on commit 7b15a17

Please sign in to comment.