Skip to content

Commit 43d7f0b

Browse files
committed
Fix debug tooling bug #213
1 parent 1d2b05f commit 43d7f0b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/cashscript/src/LibauthTemplate.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ const generateTemplateScenarioTransaction = (
293293
outpointIndex: input.outpointIndex,
294294
outpointTransactionHash: binToHex(input.outpointTransactionHash),
295295
sequenceNumber: input.sequenceNumber,
296-
unlockingBytecode: generateTemplateScenarioBytecode(csInput, `p2pkh_placeholder_unlock_${index}`, index === slotIndex),
296+
unlockingBytecode: generateTemplateScenarioBytecode(csInput, `p2pkh_placeholder_unlock_${index}`, `placeholder_key_${index}`, index === slotIndex),
297297
} as WalletTemplateScenarioInput;
298298
});
299299

@@ -330,7 +330,7 @@ const generateTemplateScenarioSourceOutputs = (
330330

331331
return csTransaction.inputs.map((input, index) => {
332332
return {
333-
lockingBytecode: generateTemplateScenarioBytecode(input, `p2pkh_placeholder_lock_${index}`, index === slotIndex),
333+
lockingBytecode: generateTemplateScenarioBytecode(input, `p2pkh_placeholder_lock_${index}`, `placeholder_key_${index}`, index === slotIndex),
334334
valueSatoshis: Number(input.satoshis),
335335
token: serialiseTokenDetails(input.token),
336336
};
@@ -339,15 +339,15 @@ const generateTemplateScenarioSourceOutputs = (
339339

340340
// Used for generating the locking / unlocking bytecode for source outputs and inputs
341341
const generateTemplateScenarioBytecode = (
342-
input: Utxo, p2pkhScriptName: string, insertSlot?: boolean,
342+
input: Utxo, p2pkhScriptName: string, placeholderKeyName: string, insertSlot?: boolean,
343343
): WalletTemplateScenarioBytecode | ['slot'] => {
344344
if (isUtxoP2PKH(input)) {
345345
return {
346346
script: p2pkhScriptName,
347347
overrides: {
348348
keys: {
349349
privateKeys: {
350-
placeholder_key: binToHex(input.template.privateKey),
350+
[placeholderKeyName]: binToHex(input.template.privateKey),
351351
},
352352
},
353353
},

packages/cashscript/test/fixture/libauth-template/fixtures.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ export const fixtures: Fixture[] = [
10641064
'overrides': {
10651065
'keys': {
10661066
'privateKeys': {
1067-
'placeholder_key': '36f8155c559f3a670586bbbf9fd52beef6f96124f5a3a39c167fc24b052d24d7',
1067+
'placeholder_key_0': '36f8155c559f3a670586bbbf9fd52beef6f96124f5a3a39c167fc24b052d24d7',
10681068
},
10691069
},
10701070
},
@@ -1087,7 +1087,7 @@ export const fixtures: Fixture[] = [
10871087
'overrides': {
10881088
'keys': {
10891089
'privateKeys': {
1090-
'placeholder_key': '71080d8b52ec7b12adaec909ed54cd989b682ce2c35647eec219a16f5f90c528',
1090+
'placeholder_key_2': '71080d8b52ec7b12adaec909ed54cd989b682ce2c35647eec219a16f5f90c528',
10911091
},
10921092
},
10931093
},
@@ -1114,7 +1114,7 @@ export const fixtures: Fixture[] = [
11141114
'overrides': {
11151115
'keys': {
11161116
'privateKeys': {
1117-
'placeholder_key': '36f8155c559f3a670586bbbf9fd52beef6f96124f5a3a39c167fc24b052d24d7',
1117+
'placeholder_key_0': '36f8155c559f3a670586bbbf9fd52beef6f96124f5a3a39c167fc24b052d24d7',
11181118
},
11191119
},
11201120
},
@@ -1133,7 +1133,7 @@ export const fixtures: Fixture[] = [
11331133
'overrides': {
11341134
'keys': {
11351135
'privateKeys': {
1136-
'placeholder_key': '71080d8b52ec7b12adaec909ed54cd989b682ce2c35647eec219a16f5f90c528',
1136+
'placeholder_key_2': '71080d8b52ec7b12adaec909ed54cd989b682ce2c35647eec219a16f5f90c528',
11371137
},
11381138
},
11391139
},

0 commit comments

Comments
 (0)