From e08777f58ec63b1d7420176b773bdd87ea41465c Mon Sep 17 00:00:00 2001 From: KhalilBellakrid Date: Fri, 9 Nov 2018 10:21:48 +0100 Subject: [PATCH] Decred Integration --- src/commands/libcoreSignAndBroadcast.js | 7 +++++++ src/config/cryptocurrencies.js | 1 + 2 files changed, 8 insertions(+) diff --git a/src/commands/libcoreSignAndBroadcast.js b/src/commands/libcoreSignAndBroadcast.js index 79cdaed5..542fb715 100644 --- a/src/commands/libcoreSignAndBroadcast.js +++ b/src/commands/libcoreSignAndBroadcast.js @@ -115,6 +115,8 @@ async function signTransaction({ if (blockHeight >= 419200) { additionals.push('sapling') } + } else if (currency.id === 'decred') { + expiryHeight = Buffer.from([0x00, 0x00, 0x00, 0x00]) } const rawInputs = transaction.getInputs() @@ -122,6 +124,10 @@ async function signTransaction({ const inputs = await Promise.all( rawInputs.map(async input => { + const additionals = [] + if (currency.id === 'decred') { + additionals.push('decred') + } const rawPreviousTransaction = await input.getPreviousTransaction() const hexPreviousTransaction = Buffer.from(rawPreviousTransaction).toString('hex') const previousTransaction = hwApp.splitTransaction( @@ -129,6 +135,7 @@ async function signTransaction({ currency.supportsSegwit, hasTimestamp, hasExtraData, + additionals, ) const outputIndex = input.getPreviousOutputIndex() const sequence = input.getSequence() diff --git a/src/config/cryptocurrencies.js b/src/config/cryptocurrencies.js index 4c6d1ea5..c29ccbc7 100644 --- a/src/config/cryptocurrencies.js +++ b/src/config/cryptocurrencies.js @@ -27,6 +27,7 @@ const supported: CryptoCurrencyIds[] = [ 'stealthcoin', 'poswallet', 'clubcoin', + 'decred', 'bitcoin_testnet', ]