Skip to content

Commit ddb18fc

Browse files
committed
update
1 parent 7c95002 commit ddb18fc

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/neuron-wallet/src/services/transaction-sender.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,15 @@ export default class TransactionSender {
188188
// TODO: fill in required DAO's type witness here
189189
witnessArgs,
190190
lockHash: input.lockHash!,
191-
witness: '',
191+
witness: typeof wit === 'string' ? wit : '',
192192
lockArgs,
193193
}
194194
})
195195

196196
const lockHashes = new Set(witnessSigningEntries.map(w => w.lockHash))
197197

198198
let perunLockHash = ''
199+
let isCloseChannel = false
199200

200201
for (const lockHash of lockHashes) {
201202
const witnessesArgs = witnessSigningEntries.filter(w => w.lockHash === lockHash)
@@ -207,6 +208,16 @@ export default class TransactionSender {
207208
privateKey = findPrivateKey(witnessesArgs[0].lockArgs)
208209
} catch (error) {
209210
const input = tx.inputs.find(input => input.lockHash === lockHash)
211+
212+
if (
213+
input &&
214+
input.lock &&
215+
input.lock.codeHash === '0x8c2d2f2f9468cf847823286ac11da09bfaef3e72a8acbac4e457ca4beadedfe4'
216+
) {
217+
isCloseChannel = true
218+
continue
219+
}
220+
210221
if (
211222
input &&
212223
input.lock &&
@@ -280,7 +291,7 @@ export default class TransactionSender {
280291
}
281292

282293
tx.witnesses = witnessSigningEntries.map(w => {
283-
if (w.lockHash === perunLockHash) {
294+
if (!isCloseChannel && w.lockHash === perunLockHash) {
284295
return '0x19000000100000001000000019000000050000000000000000'
285296
}
286297
return w.witness

0 commit comments

Comments
 (0)